diff --git a/lib/controllers/post_write_controller.dart b/lib/controllers/post_write_controller.dart index 86fe626..90d1b8b 100644 --- a/lib/controllers/post_write_controller.dart +++ b/lib/controllers/post_write_controller.dart @@ -206,7 +206,7 @@ class PostWriteController extends ChangeNotifier { tags = List.from(post.tags.map((ele) => ele.alias)); attachments.addAll(post.preload?.attachments?.map((ele) => PostWriteMedia(ele)) ?? []); - if (post.preload?.thumbnail != null) { + if (post.preload?.thumbnail != null && (post.preload?.thumbnail?.rid.isNotEmpty ?? false)) { thumbnail = PostWriteMedia(post.preload!.thumbnail); } diff --git a/lib/widgets/post/post_item.dart b/lib/widgets/post/post_item.dart index 3433638..bd7d116 100644 --- a/lib/widgets/post/post_item.dart +++ b/lib/widgets/post/post_item.dart @@ -3,7 +3,6 @@ import 'dart:math' as math; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; -import 'package:google_fonts/google_fonts.dart'; import 'package:material_symbols_icons/symbols.dart'; import 'package:popover/popover.dart'; import 'package:provider/provider.dart'; @@ -148,6 +147,7 @@ class PostItem extends StatelessWidget { if (data.repostTo != null) _PostQuoteContent(child: data.repostTo!).padding( horizontal: 12, + bottom: data.preload?.attachments?.isNotEmpty ?? false ? 12 : 0, ), if (data.visibility > 0) _PostVisibilityHint(data: data).padding( @@ -606,26 +606,33 @@ class _PostQuoteContent extends StatelessWidget { @override Widget build(BuildContext context) { - return Container( - decoration: BoxDecoration( - borderRadius: const BorderRadius.all(Radius.circular(8)), - border: Border.all( - color: Theme.of(context).dividerColor, - width: 1, + return GestureDetector( + child: Container( + decoration: BoxDecoration( + borderRadius: const BorderRadius.all(Radius.circular(8)), + border: Border.all( + color: Theme.of(context).dividerColor, + width: 1, + ), + ), + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: Column( + children: [ + _PostContentHeader( + data: child, + isCompact: true, + showMenu: false, + onDeleted: () {}, + ).padding(bottom: 4), + _PostContentBody(data: child), + ], ), ), - padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: Column( - children: [ - _PostContentHeader( - data: child, - isCompact: true, - showMenu: false, - onDeleted: () {}, - ).padding(bottom: 4), - _PostContentBody(data: child), - ], - ), + onTap: () { + GoRouter.of(context).pushNamed('postDetail', pathParameters: { + 'slug': child.id.toString(), + }); + }, ); } }