Skip to content

Commit

Permalink
[Presentation] Minor sanity check
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfteam committed Nov 13, 2022
1 parent 92fb7a7 commit 496b219
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
4 changes: 3 additions & 1 deletion lib/presentation/settings/widgets/theme_settings_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<SettingsBloc>().add(SettingsEvent.useDarkAmoledTheme(newValue: newVal)),
Expand Down
19 changes: 11 additions & 8 deletions lib/presentation/shared/unlock_with_donation_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 496b219

Please sign in to comment.