Featured replies clickable

This commit is contained in:
LittleSheep 2024-09-23 23:34:25 +08:00
parent 9d5c452eae
commit 22b2ae32e9

View File

@ -101,11 +101,14 @@ class _PostItemState extends State<PostItem> {
onChange: (size) { onChange: (size) {
setState(() => _contentHeight = size.height); setState(() => _contentHeight = size.height);
}, },
child: MarkdownTextContent( child: SingleChildScrollView(
parentId: 'p${item.id}', physics: const NeverScrollableScrollPhysics(),
content: item.body['content'], child: MarkdownTextContent(
isAutoWarp: item.type == 'story', parentId: 'p${item.id}',
isSelectable: widget.isContentSelectable, content: item.body['content'],
isAutoWarp: item.type == 'story',
isSelectable: widget.isContentSelectable,
),
).paddingOnly( ).paddingOnly(
left: 16, left: 16,
right: 12, right: 12,
@ -374,60 +377,81 @@ class _PostFeaturedReplyWidget extends StatelessWidget {
child: Column( child: Column(
children: snapshot.data! children: snapshot.data!
.map( .map(
(reply) => Row( (reply) => ClipRRect(
mainAxisAlignment: MainAxisAlignment.center, borderRadius: const BorderRadius.all(Radius.circular(8)),
crossAxisAlignment: CrossAxisAlignment.start, child: OpenContainer(
children: [ closedBuilder: (_, openContainer) => Row(
AccountAvatar(content: reply.author.avatar, radius: 10), mainAxisAlignment: MainAxisAlignment.center,
const Gap(6), crossAxisAlignment: CrossAxisAlignment.start,
Text( children: [
reply.author.nick, AccountAvatar(
style: const TextStyle(fontWeight: FontWeight.bold), content: reply.author.avatar,
), radius: 10,
const Gap(6), ),
Text( const Gap(6),
format( Text(
reply.publishedAt?.toLocal() ?? DateTime.now(), reply.author.nick,
locale: 'en_short', style:
), const TextStyle(fontWeight: FontWeight.bold),
).paddingOnly(top: 0.5), ),
const Gap(8), const Gap(6),
Expanded( Text(
child: Column( format(
crossAxisAlignment: CrossAxisAlignment.start, reply.publishedAt?.toLocal() ?? DateTime.now(),
children: [ locale: 'en_short',
MarkdownTextContent(
isAutoWarp: reply.type == 'story',
content: reply.body['content'],
parentId:
'p${item.id}-featured-reply${reply.id}',
), ),
if (reply.body['attachments'] is List && ).paddingOnly(top: 0.5),
reply.body['attachments'].isNotEmpty) const Gap(8),
Row( Expanded(
children: [ child: Column(
Icon( crossAxisAlignment: CrossAxisAlignment.start,
Icons.file_copy, children: [
size: 15, MarkdownTextContent(
color: unFocusColor, isAutoWarp: reply.type == 'story',
).paddingOnly(right: 5), content: reply.body['content'],
Text( parentId:
'attachmentHint'.trParams( 'p${item.id}-featured-reply${reply.id}',
{ ),
'count': reply if (reply.body['attachments'] is List &&
.body['attachments'].length reply.body['attachments'].isNotEmpty)
.toString(), Row(
}, children: [
), Icon(
style: TextStyle(color: unFocusColor), Icons.file_copy,
size: 15,
color: unFocusColor,
).paddingOnly(right: 5),
Text(
'attachmentHint'.trParams(
{
'count': reply
.body['attachments'].length
.toString(),
},
),
style: TextStyle(color: unFocusColor),
),
],
), ),
], ],
), ),
], ),
],
).paddingSymmetric(horizontal: 12, vertical: 8),
openBuilder: (_, __) => TitleShell(
title: 'postDetail'.tr,
child: PostDetailScreen(
id: reply.id.toString(),
post: reply,
), ),
), ),
], closedElevation: 0,
).paddingSymmetric(horizontal: 12, vertical: 8), openElevation: 0,
closedColor:
Theme.of(context).colorScheme.surfaceContainer,
openColor: Theme.of(context).colorScheme.surface,
),
),
) )
.toList(), .toList(),
), ),