let AI comment everything because well... yeah...
This commit is contained in:
@@ -1,17 +1,26 @@
|
||||
// * Helper class for displaying confirmation dialogs
|
||||
// * Used when viewing and managing database entries
|
||||
// * Provides dialogs for deleting entries and templates
|
||||
|
||||
import 'package:fforte/enums/databases.dart';
|
||||
import 'package:fforte/l10n/app_localizations.dart';
|
||||
import 'package:fforte/screens/sharedMethods/delete_main_entries.dart';
|
||||
import 'package:fforte/screens/sharedMethods/delete_templates.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Helper class for managing confirmation dialogs
|
||||
/// Contains static methods for showing delete confirmation dialogs
|
||||
class ViewEntriesDialogHelper {
|
||||
/// Show confirmation dialog for deleting all main entries
|
||||
/// @param context The BuildContext to show the dialog in
|
||||
/// @param dbType The type of database (place/excursion) to delete from
|
||||
static Future<void> deleteAllMainEntries(
|
||||
BuildContext context,
|
||||
DatabasesEnum dbType,
|
||||
) async {
|
||||
return showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
barrierDismissible: false, // User must make a choice
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text(AppLocalizations.of(context)!.deleteEverything),
|
||||
@@ -23,14 +32,15 @@ class ViewEntriesDialogHelper {
|
||||
),
|
||||
),
|
||||
actions: <Widget>[
|
||||
// Delete confirmation button
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
await DeleteMainEntries.deleteAll(dbType);
|
||||
|
||||
if (context.mounted) Navigator.of(context).pop();
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.deleteEverything),
|
||||
),
|
||||
// Cancel button
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
@@ -43,13 +53,16 @@ class ViewEntriesDialogHelper {
|
||||
);
|
||||
}
|
||||
|
||||
/// Show confirmation dialog for deleting all templates
|
||||
/// @param context The BuildContext to show the dialog in
|
||||
/// @param dbType The type of database (place/excursion) to delete from
|
||||
static Future<void> deleteAllTemplates(
|
||||
BuildContext context,
|
||||
DatabasesEnum dbType,
|
||||
) async {
|
||||
return showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
barrierDismissible: false, // User must make a choice
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text(AppLocalizations.of(context)!.deleteEverything),
|
||||
@@ -61,6 +74,7 @@ class ViewEntriesDialogHelper {
|
||||
),
|
||||
),
|
||||
actions: <Widget>[
|
||||
// Delete confirmation button
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
await DeleteTemplates.deleteAll(dbType);
|
||||
@@ -68,6 +82,7 @@ class ViewEntriesDialogHelper {
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.deleteEverything),
|
||||
),
|
||||
// Cancel button
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
@@ -79,5 +94,4 @@ class ViewEntriesDialogHelper {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user