🐛 Fixes the lifecycle issue of chat #211

This commit is contained in:
2025-12-27 22:48:55 +08:00
parent f541580281
commit 6b0343d3dc
4 changed files with 138 additions and 124 deletions

View File

@@ -26,13 +26,12 @@ class PostItemScreenshot extends ConsumerWidget {
final renderingPadding =
padding ?? const EdgeInsets.symmetric(horizontal: 8, vertical: 8);
final mostReaction =
item.reactionsCount.isEmpty
? null
: item.reactionsCount.entries
.sortedBy((e) => e.value)
.map((e) => e.key)
.last;
final mostReaction = item.reactionsCount.isEmpty
? null
: item.reactionsCount.entries
.sortedBy((e) => e.value)
.map((e) => e.key)
.last;
final isDark = MediaQuery.of(context).platformBrightness == Brightness.dark;
@@ -51,27 +50,27 @@ class PostItemScreenshot extends ConsumerWidget {
isInteractive: false,
renderingPadding: renderingPadding,
isRelativeTime: false,
trailing:
mostReaction != null
? Row(
children: [
Text(
kReactionTemplates[mostReaction]?.icon ?? '',
style: const TextStyle(fontSize: 20),
),
const Gap(4),
Text(
'x${item.reactionsCount[mostReaction]}',
style: const TextStyle(fontSize: 11),
),
],
)
: null,
trailing: mostReaction != null
? Row(
children: [
Text(
kReactionTemplates[mostReaction]?.icon ?? '',
style: const TextStyle(fontSize: 20),
),
const Gap(4),
Text(
'x${item.reactionsCount[mostReaction]}',
style: const TextStyle(fontSize: 11),
),
],
)
: null,
),
PostBody(
item: item,
renderingPadding: renderingPadding,
isFullPost: isFullPost,
isRelativeTime: false,
isTextSelectable: false,
isInteractive: false,
hideOverlay: true,

View File

@@ -816,17 +816,7 @@ class PostBody extends ConsumerWidget {
Row(
spacing: 8,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Icon(Symbols.edit, size: 16),
hideOverlay
? text
: Tooltip(
message: !isFullPost && isRelativeTime
? item.editedAt!.formatSystem()
: item.editedAt!.formatRelative(context),
child: text,
),
],
children: [const Icon(Symbols.edit, size: 16), text],
),
);
}

View File

@@ -240,7 +240,7 @@ class PostSubscriptionFilterWidget extends HookConsumerWidget {
horizontal: 16,
),
);
}).toList(),
}),
],
);
},