From 2445d8adf81d38039274811c292942842a426bff Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Mon, 17 Nov 2025 01:23:27 +0800 Subject: [PATCH] :lipstick: Optimzations --- lib/screens/wallet.dart | 79 +++++++++++++--------------- lib/widgets/post/compose_shared.dart | 7 +-- 2 files changed, 39 insertions(+), 47 deletions(-) diff --git a/lib/screens/wallet.dart b/lib/screens/wallet.dart index 07b2fce1..efd145b7 100644 --- a/lib/screens/wallet.dart +++ b/lib/screens/wallet.dart @@ -197,49 +197,46 @@ class _CreateFundSheetState extends State { }, ), - // Split Type Section (only show when there are 2+ recipients) - if (selectedRecipients.length >= 2) ...[ - const Gap(16), - Text( - 'splitType'.tr(), - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - color: Theme.of(context).colorScheme.primary, + const Gap(16), + Text( + 'splitType'.tr(), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Theme.of(context).colorScheme.primary, + ), + ), + const Gap(8), + Row( + children: [ + Expanded( + child: RadioListTile( + title: Text('evenSplit'.tr()), + subtitle: Text('equalAmountEach'.tr()), + value: 0, + groupValue: selectedSplitType, + onChanged: (value) { + if (value != null) { + setState(() => selectedSplitType = value); + } + }, + ), ), - ), - const Gap(8), - Row( - children: [ - Expanded( - child: RadioListTile( - title: Text('evenSplit'.tr()), - subtitle: Text('equalAmountEach'.tr()), - value: 0, - groupValue: selectedSplitType, - onChanged: (value) { - if (value != null) { - setState(() => selectedSplitType = value); - } - }, - ), + Expanded( + child: RadioListTile( + title: Text('randomSplit'.tr()), + subtitle: Text('randomAmountEach'.tr()), + value: 1, + groupValue: selectedSplitType, + onChanged: (value) { + if (value != null) { + setState(() => selectedSplitType = value); + } + }, ), - Expanded( - child: RadioListTile( - title: Text('randomSplit'.tr()), - subtitle: Text('randomAmountEach'.tr()), - value: 1, - groupValue: selectedSplitType, - onChanged: (value) { - if (value != null) { - setState(() => selectedSplitType = value); - } - }, - ), - ), - ], - ), - ], + ), + ], + ), const Gap(16), diff --git a/lib/widgets/post/compose_shared.dart b/lib/widgets/post/compose_shared.dart index 0e7eff1d..e4e180a4 100644 --- a/lib/widgets/post/compose_shared.dart +++ b/lib/widgets/post/compose_shared.dart @@ -685,12 +685,7 @@ class ComposeLogic { final hasAttachments = state.attachments.value.isNotEmpty; if (!hasContent && !hasAttachments) { - // Show error message if context is mounted - if (context.mounted) { - ScaffoldMessenger.of( - context, - ).showSnackBar(SnackBar(content: Text('postContentEmpty'))); - } + showErrorAlert('postContentEmpty'.tr()); throw Exception('Post content is empty'); // Don't submit empty posts }