besprechung
This commit is contained in:
@@ -4,7 +4,6 @@ import 'package:fforte/screens/sharedMethods/http_request.dart';
|
||||
import 'package:fforte/screens/sharedMethods/save_file.dart';
|
||||
import 'package:fforte/screens/sharedMethods/save_template.dart';
|
||||
import 'package:fforte/screens/sharedMethods/save_main_entry.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:fforte/l10n/app_localizations.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
@@ -106,15 +105,16 @@ class AddEntriesDialogHelper {
|
||||
);
|
||||
}
|
||||
|
||||
static Future<void> showSaveOptionsDialog(
|
||||
static Future<bool> showSaveOptionsDialog(
|
||||
BuildContext context,
|
||||
Map<String, String> saveData,
|
||||
bool isTemplate,
|
||||
DatabasesEnum dbType,
|
||||
) async {
|
||||
bool isLoading = false;
|
||||
bool pop = false;
|
||||
|
||||
return showDialog(
|
||||
await showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext context) {
|
||||
@@ -136,6 +136,7 @@ class AddEntriesDialogHelper {
|
||||
if (!isLoading)
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
pop = true;
|
||||
setState(() => isLoading = true);
|
||||
saveTemplate(saveData, dbType);
|
||||
Navigator.pushNamedAndRemoveUntil(
|
||||
@@ -143,6 +144,13 @@ class AddEntriesDialogHelper {
|
||||
'/home',
|
||||
(route) => false,
|
||||
);
|
||||
|
||||
if (context.mounted) {
|
||||
SnackBarHelper.showSnackBarMessage(
|
||||
context,
|
||||
AppLocalizations.of(context)!.erfolgreich,
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.template),
|
||||
),
|
||||
@@ -177,6 +185,7 @@ class AddEntriesDialogHelper {
|
||||
sent: true,
|
||||
);
|
||||
showSuccessDialog(context);
|
||||
pop = true;
|
||||
}
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.sendtoserver),
|
||||
@@ -187,7 +196,7 @@ class AddEntriesDialogHelper {
|
||||
setState(() => isLoading = true);
|
||||
|
||||
try {
|
||||
SaveMainEntryMethod.saveEntry(
|
||||
int id = await SaveMainEntryMethod.saveEntry(
|
||||
entryData: saveData,
|
||||
isTemplate: isTemplate,
|
||||
dbType: dbType,
|
||||
@@ -196,12 +205,20 @@ class AddEntriesDialogHelper {
|
||||
if (context.mounted) {
|
||||
await SaveFileMethod.saveFile(
|
||||
saveData,
|
||||
id,
|
||||
dbType == DatabasesEnum.place
|
||||
? AppLocalizations.of(context)!.justplace
|
||||
: AppLocalizations.of(context)!.excursion,
|
||||
dbType,
|
||||
);
|
||||
if (context.mounted) Navigator.of(context).pop();
|
||||
if (context.mounted) {
|
||||
Navigator.of(context).pop();
|
||||
SnackBarHelper.showSnackBarMessage(
|
||||
context,
|
||||
AppLocalizations.of(context)!.erfolgreich,
|
||||
);
|
||||
}
|
||||
pop = true;
|
||||
}
|
||||
} catch (_) {
|
||||
// User cancelled the dialog
|
||||
@@ -233,6 +250,13 @@ class AddEntriesDialogHelper {
|
||||
'/home',
|
||||
(route) => false,
|
||||
);
|
||||
pop = true;
|
||||
if (context.mounted) {
|
||||
SnackBarHelper.showSnackBarMessage(
|
||||
context,
|
||||
AppLocalizations.of(context)!.erfolgreich,
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint(e.toString());
|
||||
}
|
||||
@@ -252,6 +276,8 @@ class AddEntriesDialogHelper {
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
return pop;
|
||||
}
|
||||
|
||||
static Future<void> showSuccessDialog(BuildContext context) async {
|
||||
|
||||
Reference in New Issue
Block a user