From 496b219370ffea4c9188d04ec8d6fd82f8ff454a Mon Sep 17 00:00:00 2001 From: Efrain Bastidas Date: Sun, 13 Nov 2022 16:43:13 -0500 Subject: [PATCH] [Presentation] Minor sanity check --- .../settings/widgets/theme_settings_card.dart | 4 +++- .../shared/unlock_with_donation_text.dart | 19 +++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/presentation/settings/widgets/theme_settings_card.dart b/lib/presentation/settings/widgets/theme_settings_card.dart index c31712cbd..6cade97f6 100644 --- a/lib/presentation/settings/widgets/theme_settings_card.dart +++ b/lib/presentation/settings/widgets/theme_settings_card.dart @@ -61,7 +61,9 @@ class ThemeSettingsCard extends StatelessWidget { activeColor: theme.colorScheme.secondary, title: Text(s.useDarkAmoledTheme), value: state.useDarkAmoledTheme, - subtitle: state.unlockedFeatures.contains(AppUnlockedFeature.darkAmoledTheme) ? null : const UnlockWithDonationText(), + subtitle: state.unlockedFeatures.contains(AppUnlockedFeature.darkAmoledTheme) + ? null + : UnlockWithDonationText(canShowDonationDialog: darkAmoledThemeIsSupported), onChanged: !state.unlockedFeatures.contains(AppUnlockedFeature.darkAmoledTheme) ? null : (newVal) => context.read().add(SettingsEvent.useDarkAmoledTheme(newValue: newVal)), diff --git a/lib/presentation/shared/unlock_with_donation_text.dart b/lib/presentation/shared/unlock_with_donation_text.dart index c7e05c886..2bb594b70 100644 --- a/lib/presentation/shared/unlock_with_donation_text.dart +++ b/lib/presentation/shared/unlock_with_donation_text.dart @@ -4,20 +4,23 @@ import 'package:shiori/presentation/donations/donations_bottom_sheet.dart'; import 'package:shiori/presentation/shared/styles.dart'; class UnlockWithDonationText extends StatelessWidget { - const UnlockWithDonationText({super.key}); + final bool canShowDonationDialog; + const UnlockWithDonationText({super.key, required this.canShowDonationDialog}); @override Widget build(BuildContext context) { final s = S.of(context); final theme = Theme.of(context); return GestureDetector( - onTap: () => showModalBottomSheet( - context: context, - shape: Styles.modalBottomSheetShape, - isDismissible: true, - isScrollControlled: true, - builder: (ctx) => const DonationsBottomSheet(), - ), + onTap: !canShowDonationDialog + ? null + : () => showModalBottomSheet( + context: context, + shape: Styles.modalBottomSheetShape, + isDismissible: true, + isScrollControlled: true, + builder: (ctx) => const DonationsBottomSheet(), + ), child: Text( s.unlockedWithDonation, overflow: TextOverflow.ellipsis,