💄 Use unlimited variant of the fortune card, close #234

This commit is contained in:
2026-01-14 01:53:24 +08:00
parent ac5193e1f6
commit 95daa3c28d

View File

@@ -200,7 +200,7 @@ class _DashboardGridNarrow extends HookConsumerWidget {
if (userInfo.value != null && userInfo.value?.activatedAt == null) if (userInfo.value != null && userInfo.value?.activatedAt == null)
AccountUnactivatedCard(), AccountUnactivatedCard(),
CheckInWidget(margin: EdgeInsets.zero), CheckInWidget(margin: EdgeInsets.zero),
FortuneCard(), FortuneCard(unlimited: true),
ConstrainedBox( ConstrainedBox(
constraints: const BoxConstraints(maxHeight: 400), constraints: const BoxConstraints(maxHeight: 400),
child: PostFeaturedList(), child: PostFeaturedList(),
@@ -528,13 +528,14 @@ class ChatListCard extends HookConsumerWidget {
} }
class FortuneCard extends HookConsumerWidget { class FortuneCard extends HookConsumerWidget {
const FortuneCard({super.key}); final bool unlimited;
const FortuneCard({super.key, this.unlimited = false});
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final fortuneAsync = ref.watch(randomFortuneSayingProvider); final fortuneAsync = ref.watch(randomFortuneSayingProvider);
return Card( final child = Card(
margin: EdgeInsets.zero, margin: EdgeInsets.zero,
shape: const RoundedRectangleBorder( shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(12)), borderRadius: BorderRadius.all(Radius.circular(12)),
@@ -550,7 +551,7 @@ class FortuneCard extends HookConsumerWidget {
Expanded( Expanded(
child: Text( child: Text(
fortune.content, fortune.content,
maxLines: 2, maxLines: unlimited ? null : 2,
overflow: TextOverflow.fade, overflow: TextOverflow.fade,
), ),
), ),
@@ -559,7 +560,10 @@ class FortuneCard extends HookConsumerWidget {
).padding(horizontal: 16); ).padding(horizontal: 16);
}, },
), ),
).height(48); );
if (unlimited) return child;
return child.height(48);
} }
} }