Skip to content

Commit

Permalink
Show the donation dialog when tapping on the related text
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfteam committed Nov 13, 2022
1 parent 0e1a170 commit e29feaa
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
10 changes: 2 additions & 8 deletions lib/presentation/settings/widgets/theme_settings_card.dart
Expand Up @@ -11,6 +11,7 @@ import 'package:shiori/presentation/shared/common_dropdown_button.dart';
import 'package:shiori/presentation/shared/extensions/i18n_extensions.dart';
import 'package:shiori/presentation/shared/loading.dart';
import 'package:shiori/presentation/shared/styles.dart';
import 'package:shiori/presentation/shared/unlock_with_donation_text.dart';
import 'package:shiori/presentation/shared/utils/enum_utils.dart';

class ThemeSettingsCard extends StatelessWidget {
Expand Down Expand Up @@ -60,14 +61,7 @@ class ThemeSettingsCard extends StatelessWidget {
activeColor: theme.colorScheme.secondary,
title: Text(s.useDarkAmoledTheme),
value: state.useDarkAmoledTheme,
subtitle: state.unlockedFeatures.contains(AppUnlockedFeature.darkAmoledTheme)
? null
: Text(
s.unlockedWithDonation,
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: theme.textTheme.caption!.copyWith(color: theme.primaryColor, fontStyle: FontStyle.italic),
),
subtitle: state.unlockedFeatures.contains(AppUnlockedFeature.darkAmoledTheme) ? null : const UnlockWithDonationText(),
onChanged: !state.unlockedFeatures.contains(AppUnlockedFeature.darkAmoledTheme)
? null
: (newVal) => context.read<SettingsBloc>().add(SettingsEvent.useDarkAmoledTheme(newValue: newVal)),
Expand Down
29 changes: 29 additions & 0 deletions lib/presentation/shared/unlock_with_donation_text.dart
@@ -0,0 +1,29 @@
import 'package:flutter/material.dart';
import 'package:shiori/generated/l10n.dart';
import 'package:shiori/presentation/donations/donations_bottom_sheet.dart';
import 'package:shiori/presentation/shared/styles.dart';

class UnlockWithDonationText extends StatelessWidget {
const UnlockWithDonationText({super.key});

@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(),
),
child: Text(
s.unlockedWithDonation,
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: theme.textTheme.caption!.copyWith(color: theme.primaryColor, fontStyle: FontStyle.italic),
),
);
}
}

0 comments on commit e29feaa

Please sign in to comment.