added option to cancel save of data
This commit is contained in:
@@ -245,20 +245,38 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
}
|
||||
|
||||
Future<void> showSaveOptionsDialog() async {
|
||||
return showDialog(
|
||||
return
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
var dialogContext = context;
|
||||
return AlertDialog(
|
||||
title: Text(AppLocalizations.of(context)!.savemethod),
|
||||
actions: [
|
||||
|
||||
TextButton(onPressed: () async {
|
||||
saveTemplate();
|
||||
Navigator.pushNamedAndRemoveUntil(
|
||||
// ignore: use_build_context_synchronously
|
||||
context,
|
||||
'/home',
|
||||
(route) => false);
|
||||
}, child: Text(AppLocalizations.of(context)!.template)),
|
||||
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
saveFile();
|
||||
_httpRequest();
|
||||
// Navigator.pushNamedAndRemoveUntil(context, '/home', (route) => false);
|
||||
Navigator.pushNamedAndRemoveUntil(
|
||||
// ignore: use_build_context_synchronously
|
||||
context,
|
||||
'/home',
|
||||
(route) => false);
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.sendtoserver)),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
saveData();
|
||||
await saveFile();
|
||||
// ignore: use_build_context_synchronously
|
||||
Navigator.pushNamedAndRemoveUntil(
|
||||
@@ -267,7 +285,10 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
'/home',
|
||||
(route) => false);
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.saveasfile))
|
||||
child: Text(AppLocalizations.of(context)!.saveasfile)),
|
||||
TextButton(onPressed: () {
|
||||
Navigator.pop(dialogContext);
|
||||
}, child: Text(AppLocalizations.of(context)!.cancel)),
|
||||
],
|
||||
);
|
||||
});
|
||||
@@ -715,27 +736,19 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
|
||||
if (!isLastStep) {
|
||||
saveTemplate();
|
||||
|
||||
setState(() {
|
||||
currentStep += 1;
|
||||
});
|
||||
} else {
|
||||
List<String> emptyFields = validateData();
|
||||
// ! always fileed out
|
||||
empty = true;
|
||||
// ! always filled out
|
||||
empty = false;
|
||||
if (empty == true) {
|
||||
showTemplateDialog(emptyFields);
|
||||
();
|
||||
return;
|
||||
} else if (empty == false) {
|
||||
// throw const FormatException(("Speichert"));
|
||||
saveData();
|
||||
await showSaveOptionsDialog();
|
||||
Navigator.pushNamedAndRemoveUntil(
|
||||
// ignore: use_build_context_synchronously
|
||||
context,
|
||||
'/home',
|
||||
(route) => false);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user