Skip to content

Commit

Permalink
Add alert dialog guard to clearing cache
Browse files Browse the repository at this point in the history
  • Loading branch information
dhzdhd committed Jun 17, 2024
1 parent 29149c8 commit 124c105
Showing 1 changed file with 37 additions and 6 deletions.
43 changes: 37 additions & 6 deletions lib/src/settings/views/settings_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ class SettingsView extends ConsumerWidget {
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
const Text(
'Theme',
style: Theme.of(context).textTheme.titleLarge,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w400,
),
),
SizedBox(
child: DropdownMenu<ThemeMode>(
Expand Down Expand Up @@ -65,9 +68,12 @@ class SettingsView extends ConsumerWidget {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
const Text(
'Enable Sentry monitoring',
style: Theme.of(context).textTheme.titleLarge,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w400,
),
),
Switch(
value: settings.isSentryEnabled,
Expand All @@ -84,9 +90,34 @@ class SettingsView extends ConsumerWidget {
height: 50,
child: OutlinedButton(
onPressed: () async {
await folderNotifier.clearCache().run();
showDialog(
context: context,
builder: (context) => AlertDialog(
title: const Text('Are you sure'),
actions: [
OutlinedButton(
onPressed: () async {
await folderNotifier.clearCache().run();
if (context.mounted) {
Navigator.of(context).pop();
}
},
child: const Text('Yes'),
),
FilledButton(
onPressed: () {
Navigator.of(context).pop();
},
child: const Text('No'),
)
],
),
);
},
child: const Text('Clear local folder storage'),
child: const Text(
'Clear local folder storage',
style: TextStyle(fontSize: 18),
),
),
),
)
Expand Down

0 comments on commit 124c105

Please sign in to comment.