JSON Import für Testdaten & Funktion zum Löschen aller Daten #33
@@ -103,11 +103,31 @@ class _SettingsViewState extends State<SettingsView> {
|
|||||||
icon: Icons.download_outlined,
|
icon: Icons.download_outlined,
|
||||||
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
showDialog<bool>(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AlertDialog(
|
||||||
|
title: const Text('Delete all data?'),
|
||||||
|
content: const Text('This can\'t be undone'),
|
||||||
|
actions: [
|
||||||
|
flixcoo marked this conversation as resolved
Outdated
sneeex
commented
Outdated
Review
- bei delete all data auf jeden fall ein Dialog mit bestätigen, habe gerade ausversehen alle daten gelöscht xD, dachte da kommt sowas
- musst die jeweilige page dann neuladen, updated aktuell nicht
|
|||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(false),
|
||||||
|
child: const Text('Abbrechen'),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(true),
|
||||||
|
child: const Text('Löschen'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
).then((confirmed) {
|
||||||
|
if (confirmed == true && context.mounted) {
|
||||||
DataTransferService.deleteAllData(context);
|
DataTransferService.deleteAllData(context);
|
||||||
showSnackbar(
|
showSnackbar(
|
||||||
context: context,
|
context: context,
|
||||||
message: 'Data successfully deleted',
|
message: 'Daten erfolgreich gelöscht',
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user