84 lines
2.4 KiB
Dart
84 lines
2.4 KiB
Dart
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';
|
|
|
|
class ViewEntriesDialogHelper {
|
|
static void deleteAllMainEntries(
|
|
BuildContext context,
|
|
DatabasesEnum dbType,
|
|
) async {
|
|
return showDialog(
|
|
context: context,
|
|
barrierDismissible: false,
|
|
builder: (BuildContext context) {
|
|
return AlertDialog(
|
|
title: Text(AppLocalizations.of(context)!.deleteEverything),
|
|
content: SingleChildScrollView(
|
|
child: ListBody(
|
|
children: <Widget>[
|
|
Text(AppLocalizations.of(context)!.deleteEverythingContent),
|
|
],
|
|
),
|
|
),
|
|
actions: <Widget>[
|
|
TextButton(
|
|
onPressed: () {
|
|
DeleteMainEntries.deleteAll(dbType);
|
|
|
|
Navigator.of(context).pop();
|
|
},
|
|
child: Text(AppLocalizations.of(context)!.deleteEverything),
|
|
),
|
|
TextButton(
|
|
onPressed: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
child: Text(AppLocalizations.of(context)!.cancel),
|
|
),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
static void deleteAllTemplates(
|
|
BuildContext context,
|
|
DatabasesEnum dbType,
|
|
) async {
|
|
return showDialog(
|
|
context: context,
|
|
barrierDismissible: false,
|
|
builder: (BuildContext context) {
|
|
return AlertDialog(
|
|
title: Text(AppLocalizations.of(context)!.deleteEverything),
|
|
content: SingleChildScrollView(
|
|
child: ListBody(
|
|
children: <Widget>[
|
|
Text(AppLocalizations.of(context)!.deleteEverythingContent),
|
|
],
|
|
),
|
|
),
|
|
actions: <Widget>[
|
|
TextButton(
|
|
onPressed: () {
|
|
DeleteTemplates.deleteAll(dbType);
|
|
Navigator.of(context).pop();
|
|
},
|
|
child: Text(AppLocalizations.of(context)!.deleteEverything),
|
|
),
|
|
TextButton(
|
|
onPressed: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
child: Text(AppLocalizations.of(context)!.cancel),
|
|
),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
}
|