🐛 Bug fixes in posts

This commit is contained in:
LittleSheep 2025-03-19 00:29:29 +08:00
parent 060bfa4887
commit 9f8c8923d9
3 changed files with 27 additions and 25 deletions

View File

@ -151,6 +151,7 @@ class PostCommentSliverListState extends State<PostCommentSliverList> {
},
),
onTap: () {
Navigator.pop(context);
GoRouter.of(context).pushNamed(
'postDetail',
pathParameters: {'slug': _posts[idx].id.toString()},
@ -225,6 +226,9 @@ class _PostCommentListPopupState extends State<PostCommentListPopup> {
onPost: () {
_childListKey.currentState!.refresh();
},
onExpand: () {
Navigator.pop(context);
},
),
),
),

View File

@ -1597,39 +1597,30 @@ class _PostContentHeader extends StatelessWidget {
children: [
Row(
children: [
Flexible(
child: Text(data.publisher.nick).bold(),
),
Text(data.publisher.nick).bold(),
if (data.preload?.realm != null)
const Icon(Symbols.arrow_right, size: 16)
.padding(horizontal: 2)
.opacity(0.5),
if (data.preload?.realm != null)
Flexible(
child: Text(data.preload!.realm!.name),
),
if (data.preload?.realm != null) Text(data.preload!.realm!.name),
],
),
Row(
children: [
Flexible(
child: Text(
'@${data.publisher.name}',
maxLines: 1,
).fontSize(13),
),
Text(
'@${data.publisher.name}',
maxLines: 1,
).fontSize(13),
const Gap(4),
Flexible(
child: Text(
isRelativeDate
? RelativeTime(context).format(
(data.publishedAt ?? data.createdAt).toLocal())
: DateFormat('y/M/d HH:mm').format(
(data.publishedAt ?? data.createdAt).toLocal()),
maxLines: 1,
overflow: TextOverflow.fade,
).fontSize(13),
),
Text(
isRelativeDate
? RelativeTime(context)
.format((data.publishedAt ?? data.createdAt).toLocal())
: DateFormat('y/M/d HH:mm')
.format((data.publishedAt ?? data.createdAt).toLocal()),
maxLines: 1,
overflow: TextOverflow.fade,
).fontSize(13),
],
).opacity(0.8),
],

View File

@ -9,6 +9,7 @@ import 'package:styled_widget/styled_widget.dart';
import 'package:surface/controllers/post_write_controller.dart';
import 'package:surface/providers/config.dart';
import 'package:surface/providers/sn_network.dart';
import 'package:surface/screens/post/post_editor.dart';
import 'package:surface/types/post.dart';
import 'package:surface/widgets/account/account_image.dart';
import 'package:surface/widgets/dialog.dart';
@ -17,8 +18,10 @@ import 'package:surface/widgets/loading_indicator.dart';
class PostMiniEditor extends StatefulWidget {
final int? postReplyId;
final Function? onPost;
final Function? onExpand;
const PostMiniEditor({super.key, this.postReplyId, this.onPost});
const PostMiniEditor(
{super.key, this.postReplyId, this.onPost, this.onExpand});
@override
State<PostMiniEditor> createState() => _PostMiniEditorState();
@ -214,12 +217,16 @@ class _PostMiniEditorState extends State<PostMiniEditor> {
onPressed: () {
GoRouter.of(context).pushNamed(
'postEditor',
extra: PostEditorExtra(
text: _writeController.contentController.text,
),
queryParameters: {
if (widget.postReplyId != null)
'replying': widget.postReplyId.toString(),
'mode': 'stories',
},
);
widget.onExpand?.call();
},
),
TextButton.icon(