now shows every empty required field in the save as template dialog
This commit is contained in:
2
Todo.txt
2
Todo.txt
@@ -4,7 +4,6 @@ maybe auch vorschläge aus templates in dropdown menüs anzeigen
|
|||||||
beim nächsten schritt als template
|
beim nächsten schritt als template
|
||||||
im englischen abändern
|
im englischen abändern
|
||||||
Überall absätze machen und textfeld größer wenn langer text
|
Überall absätze machen und textfeld größer wenn langer text
|
||||||
beim letzten weiter alle leeren felder anzeigen (array zurückgeben)
|
|
||||||
gespeicherten ordner anzeigen
|
gespeicherten ordner anzeigen
|
||||||
zurückfeld in datenansicht
|
zurückfeld in datenansicht
|
||||||
überschriften für view cams
|
überschriften für view cams
|
||||||
@@ -26,6 +25,7 @@ eintrg in db wenn http response (in sent column)
|
|||||||
|
|
||||||
|
|
||||||
not to do:
|
not to do:
|
||||||
|
beim letzten weiter alle leeren felder anzeigen (array zurückgeben)
|
||||||
karte drehen aus
|
karte drehen aus
|
||||||
standort automatisch in Karte
|
standort automatisch in Karte
|
||||||
abbaudat leer
|
abbaudat leer
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Function to show the dialog where the user has to choose if he want to safe his values as a template
|
// Function to show the dialog where the user has to choose if he want to safe his values as a template
|
||||||
Future<void> showTemplateDialog(String emptyField) async {
|
Future<void> showTemplateDialog(List<String> emptyField) async {
|
||||||
return showDialog(
|
return showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
@@ -224,7 +224,7 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: Text(AppLocalizations.of(context)!.fieldEmpty),
|
title: Text(AppLocalizations.of(context)!.fieldEmpty),
|
||||||
content: SingleChildScrollView(
|
content: SingleChildScrollView(
|
||||||
child: ListBody(children: <Widget>[Text(emptyField)]),
|
child: ListBody(children: <Widget>[Text(emptyField.join("; "))]),
|
||||||
),
|
),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
@@ -326,7 +326,10 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// checks if required fields are not empty. If one is the name will be returned
|
// checks if required fields are not empty. If one is the name will be returned
|
||||||
String validateData() {
|
List<String> validateData() {
|
||||||
|
|
||||||
|
List<String> emptyFields = <String>[];
|
||||||
|
|
||||||
Map<String, TextEditingController> fields = {
|
Map<String, TextEditingController> fields = {
|
||||||
'CID': id,
|
'CID': id,
|
||||||
'Rudel': rudelC,
|
'Rudel': rudelC,
|
||||||
@@ -347,14 +350,13 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
|
|
||||||
for (var entry in fields.entries) {
|
for (var entry in fields.entries) {
|
||||||
if (entry.value.text.isEmpty) {
|
if (entry.value.text.isEmpty) {
|
||||||
empty = true;
|
emptyFields.add(entry.key);
|
||||||
return entry.key;
|
|
||||||
} else {
|
|
||||||
empty = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
if (emptyFields.isEmpty) empty = true;
|
||||||
|
|
||||||
|
return emptyFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the user decides to safe his values as a template this function is called to save the values in the database
|
// If the user decides to safe his values as a template this function is called to save the values in the database
|
||||||
@@ -718,11 +720,11 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
currentStep += 1;
|
currentStep += 1;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String emptyField = validateData();
|
List<String> emptyFields = validateData();
|
||||||
// ! always fileed out
|
// ! always fileed out
|
||||||
empty = false;
|
empty = true;
|
||||||
if (empty == true) {
|
if (empty == true) {
|
||||||
showTemplateDialog(emptyField);
|
showTemplateDialog(emptyFields);
|
||||||
();
|
();
|
||||||
return;
|
return;
|
||||||
} else if (empty == false) {
|
} else if (empty == false) {
|
||||||
|
|||||||
Reference in New Issue
Block a user