diff --git a/lib/screens/addCam/add_cam_main.dart b/lib/screens/addCam/add_cam_main.dart index 0edaec8..7df4020 100644 --- a/lib/screens/addCam/add_cam_main.dart +++ b/lib/screens/addCam/add_cam_main.dart @@ -55,7 +55,6 @@ class _AddCamMainState extends State { headingAccuracy: 0.0, ); - Map> rmap = { "ID": {"controller": TextEditingController(), "required": false}, // Step 1 @@ -154,7 +153,7 @@ class _AddCamMainState extends State { @override void initState() { super.initState(); - + isTemplate = widget.isTemplate; // If a template is edited this fills in the existing values @@ -177,35 +176,33 @@ class _AddCamMainState extends State { rmap["DECLNG"]!["controller"]!.text = currentPosition.longitude.toString(); // Try to get current position - GeolocatorService.deteterminePosition() - .then((result) { - if (mounted) { - setState(() { - currentPosition = result; - // Update coordinates after getting the position - rmap["DECLAT"]!["controller"]!.text = result.latitude.toString(); - rmap["DECLNG"]!["controller"]!.text = result.longitude.toString(); - }); - } - }) - .catchError((error) { - if (error is LocationDisabledException) { - if (mounted) { - SnackBarHelper.showSnackBarMessage( - context, - AppLocalizations.of(context)!.locationDisabled, - ); - } - } else if (error is LocationForbiddenException) { - if (mounted) { - SnackBarHelper.showSnackBarMessage( - context, - AppLocalizations.of(context)!.locationForbidden, - ); - } - } - return currentPosition; + GeolocatorService.deteterminePosition().then((result) { + if (mounted) { + setState(() { + currentPosition = result; + // Update coordinates after getting the position + rmap["DECLAT"]!["controller"]!.text = result.latitude.toString(); + rmap["DECLNG"]!["controller"]!.text = result.longitude.toString(); }); + } + }).catchError((error) { + if (error is LocationDisabledException) { + if (mounted) { + SnackBarHelper.showSnackBarMessage( + context, + AppLocalizations.of(context)!.locationDisabled, + ); + } + } else if (error is LocationForbiddenException) { + if (mounted) { + SnackBarHelper.showSnackBarMessage( + context, + AppLocalizations.of(context)!.locationForbidden, + ); + } + } + return currentPosition; + }); } @override @@ -222,429 +219,437 @@ class _AddCamMainState extends State { Widget build(BuildContext context) { // List with the steps. The steps itself will be "shown" later List getSteps() => [ - // First step - Step( - title: Text(AppLocalizations.of(context)!.firststep), - content: Column( - children: [ - Align( - alignment: Alignment.bottomLeft, - child: VarTextField( - required: true, - dbName: "Standort", - textController: rmap["Standort"]!["controller"]!, - // textController: betreuungC, - localization: AppLocalizations.of(context)!.altstort, - dbDesignation: DatabasesEnum.place, - ), - ), - const SizedBox(height: 5), - // -------------------- - Align( - alignment: Alignment.bottomLeft, - child: Row( - children: [ - Text(AppLocalizations.of(context)!.status), - const Text('*', style: TextStyle(color: Colors.red)), - ], - ), - ), - Status( - initialStatus: rmap["Status"]!["controller"]!.text, - onStatusChanged: (status) { - setState(() { - rmap["Status"]!["controller"]!.text = status; - }); - }, - ), - // -------------------- - VarTextField( - textController: rmap["Betreuung"]!["controller"]!, - localization: AppLocalizations.of(context)!.betreuung, - dbName: "Betreuung", - required: false, - dbDesignation: DatabasesEnum.place, - ), - const SizedBox(height: 20), - // -------------------- - VarTextField( - textController: rmap["CID"]!["controller"], - localization: AppLocalizations.of(context)!.camLink, - dbName: "CID", - required: true, - dbDesignation: DatabasesEnum.place, - ), - // -------------------- - VarTextField( - textController: rmap["FFTyp"]!["controller"], - localization: AppLocalizations.of(context)!.fftyp, - dbName: "FFTyp", - required: true, - dbDesignation: DatabasesEnum.place, - ), - const SizedBox(height: 15), - // -------------------- - Align( - alignment: Alignment.bottomLeft, - child: Row( - children: [ - Text(AppLocalizations.of(context)!.zeiteinstellung), - const Text('*', style: TextStyle(color: Colors.red)), - ], - ), - ), - MEZ( - initialMEZ: rmap["MEZ"]!["controller"]!.text, - onMEZChanged: (mez) { - setState(() { - rmap["MEZ"]!["controller"]!.text = mez; - }); - }, - ), - const SizedBox(height: 15), - // -------------------- - VarTextField( - textController: rmap["KSchloNr"]!["controller"], - localization: AppLocalizations.of(context)!.kschlonr, - dbName: "KSchloNr", - required: false, - dbDesignation: DatabasesEnum.place, - ), - const SizedBox(height: 5), - // -------------------- - VarTextField( - textController: rmap["Rudel"]!["controller"], - localization: AppLocalizations.of(context)!.rudel, - dbName: "Rudel", - required: true, - dbDesignation: DatabasesEnum.place, - ), - const SizedBox(height: 15), - ], - ), - ), - - // Second step - Step( - title: Text(AppLocalizations.of(context)!.secondstep), - content: Column( - children: [ - Row( + // First step + Step( + title: Text(AppLocalizations.of(context)!.firststep), + content: Column( children: [ - Column( + Align( + alignment: Alignment.bottomLeft, + child: VarTextField( + required: true, + dbName: "Standort", + textController: rmap["Standort"]!["controller"]!, + // textController: betreuungC, + localization: AppLocalizations.of(context)!.altstort, + dbDesignation: DatabasesEnum.place, + ), + ), + const SizedBox(height: 5), + // -------------------- + Align( + alignment: Alignment.bottomLeft, + child: Row( + children: [ + Text(AppLocalizations.of(context)!.status), + const Text('*', style: TextStyle(color: Colors.red)), + ], + ), + ), + Status( + initialStatus: rmap["Status"]!["controller"]!.text, + onStatusChanged: (status) { + setState(() { + rmap["Status"]!["controller"]!.text = status; + }); + }, + ), + // -------------------- + VarTextField( + textController: rmap["Betreuung"]!["controller"]!, + localization: AppLocalizations.of(context)!.betreuung, + dbName: "Betreuung", + required: false, + dbDesignation: DatabasesEnum.place, + ), + const SizedBox(height: 20), + // -------------------- + VarTextField( + textController: rmap["CID"]!["controller"], + localization: AppLocalizations.of(context)!.camLink, + dbName: "CID", + required: true, + dbDesignation: DatabasesEnum.place, + ), + // -------------------- + VarTextField( + textController: rmap["FFTyp"]!["controller"], + localization: AppLocalizations.of(context)!.fftyp, + dbName: "FFTyp", + required: true, + dbDesignation: DatabasesEnum.place, + ), + const SizedBox(height: 15), + // -------------------- + Align( + alignment: Alignment.bottomLeft, + child: Row( + children: [ + Text(AppLocalizations.of(context)!.zeiteinstellung), + const Text('*', style: TextStyle(color: Colors.red)), + ], + ), + ), + MEZ( + initialMEZ: rmap["MEZ"]!["controller"]!.text, + onMEZChanged: (mez) { + setState(() { + rmap["MEZ"]!["controller"]!.text = mez; + }); + }, + ), + const SizedBox(height: 15), + // -------------------- + VarTextField( + textController: rmap["KSchloNr"]!["controller"], + localization: AppLocalizations.of(context)!.kschlonr, + dbName: "KSchloNr", + required: false, + dbDesignation: DatabasesEnum.place, + ), + const SizedBox(height: 5), + // -------------------- + VarTextField( + textController: rmap["Rudel"]!["controller"], + localization: AppLocalizations.of(context)!.rudel, + dbName: "Rudel", + required: true, + dbDesignation: DatabasesEnum.place, + ), + const SizedBox(height: 15), + ], + ), + ), + + // Second step + Step( + title: Text(AppLocalizations.of(context)!.secondstep), + content: Column( + children: [ + Row( children: [ - Text(rmap["DECLAT"]!["controller"]!.text), - Text(rmap["DECLNG"]!["controller"]!.text), + Column( + children: [ + Text(rmap["DECLAT"]!["controller"]!.text), + Text(rmap["DECLNG"]!["controller"]!.text), + ], + ), + const SizedBox(width: 15), + ElevatedButton( + onPressed: () async { + setState(() { + isLoadingPosition = true; + }); + + try { + await _initializePosition(); + } catch (e) { + // Error already handled in _initializePosition + if (mounted) { + setState(() { + isLoadingPosition = false; + }); + return; + } + } + + if (!mounted) return; + + final result = await Navigator.of(context).push( + MaterialPageRoute( + builder: (context) { + return Karte( + ortInfoC: rmap["OrtInfo"]!["controller"], + beiOrtC: rmap["BeiOrt"]!["controller"], + currentPosition: currentPosition, + decLatC: rmap["DECLAT"]!["controller"], + decLngC: rmap["DECLNG"]!["controller"], + ); + }, + ), + ); + + if (result != null && mounted) { + setState(() { + currentPosition = Position( + latitude: result.latitude, + longitude: result.longitude, + timestamp: DateTime.now(), + accuracy: 0.0, + altitude: 0.0, + altitudeAccuracy: 0.0, + heading: 0.0, + headingAccuracy: 0.0, + speed: 0.0, + speedAccuracy: 0.0, + ); + rmap["DECLAT"]!["controller"]!.text = + result.latitude.toString(); + rmap["DECLNG"]!["controller"]!.text = + result.longitude.toString(); + isLoadingPosition = false; + }); + } else if (mounted) { + setState(() { + isLoadingPosition = false; + }); + } + }, + child: isLoadingPosition + ? Row( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox( + width: 16, + height: 16, + child: CircularProgressIndicator( + strokeWidth: 2, + color: + Theme.of(context).colorScheme.onPrimary, + ), + ), + const SizedBox(width: 8), + Text(AppLocalizations.of(context)!.openMap), + ], + ) + : Text(AppLocalizations.of(context)!.openMap), + ), ], ), - const SizedBox(width: 15), - ElevatedButton( - onPressed: () async { + // -------------------- + VarTextField( + textController: rmap["BLand"]!["controller"]!, + localization: AppLocalizations.of(context)!.bland, + dbName: "BLand", + required: true, + dbDesignation: DatabasesEnum.place, + defaultValue: "bLand", + ), + // -------------------- + VarTextField( + textController: rmap["Lkr"]!["controller"]!, + localization: AppLocalizations.of(context)!.lkr, + dbName: "Lkr", + required: true, + dbDesignation: DatabasesEnum.place, + ), + // -------------------- + VarTextField( + textController: rmap["BeiOrt"]!["controller"]!, + localization: AppLocalizations.of(context)!.beiort, + dbName: "BeiOrt", + required: true, + dbDesignation: DatabasesEnum.place, + ), + // -------------------- + VarTextField( + textController: rmap["OrtInfo"]!["controller"]!, + localization: AppLocalizations.of(context)!.ortinfo, + dbName: "OrtInfo", + required: false, + dbDesignation: DatabasesEnum.place, + ), + const SizedBox(height: 15), + // -------------------- + Align( + alignment: Alignment.bottomLeft, + child: Row( + children: [ + Text(AppLocalizations.of(context)!.platzung), + const Text('*', style: TextStyle(color: Colors.red)), + ], + ), + ), + Platzung( + initialPlatzung: rmap["Platzung"]!["controller"]!.text, + onPlatzungChanged: (platzung) { setState(() { - isLoadingPosition = true; + rmap["Platzung"]!["controller"]!.text = platzung; }); - - try { - await _initializePosition(); - } catch (e) { - // Error already handled in _initializePosition - if (mounted) { - setState(() { - isLoadingPosition = false; - }); - return; - } - } - - if (!mounted) return; - - final result = await Navigator.of(context).push( - MaterialPageRoute( - builder: (context) { - return Karte( - ortInfoC: rmap["OrtInfo"]!["controller"], - beiOrtC: rmap["BeiOrt"]!["controller"], - currentPosition: currentPosition, - decLatC: rmap["DECLAT"]!["controller"], - decLngC: rmap["DECLNG"]!["controller"], - ); - }, - ), - ); - - if (result != null && mounted) { - setState(() { - currentPosition = Position( - latitude: result.latitude, - longitude: result.longitude, - timestamp: DateTime.now(), - accuracy: 0.0, - altitude: 0.0, - altitudeAccuracy: 0.0, - heading: 0.0, - headingAccuracy: 0.0, - speed: 0.0, - speedAccuracy: 0.0, - ); - rmap["DECLAT"]!["controller"]!.text = result.latitude.toString(); - rmap["DECLNG"]!["controller"]!.text = result.longitude.toString(); - isLoadingPosition = false; - }); - } else if (mounted) { - setState(() { - isLoadingPosition = false; - }); - } }, - child: isLoadingPosition - ? Row( - mainAxisSize: MainAxisSize.min, - children: [ - SizedBox( - width: 16, - height: 16, - child: CircularProgressIndicator( - strokeWidth: 2, - color: Theme.of(context).colorScheme.onPrimary, - ), - ), - const SizedBox(width: 8), - Text(AppLocalizations.of(context)!.openMap), - ], - ) - : Text(AppLocalizations.of(context)!.openMap), ), ], ), - // -------------------- - VarTextField( - textController: rmap["BLand"]!["controller"]!, - localization: AppLocalizations.of(context)!.bland, - dbName: "BLand", - required: true, - dbDesignation: DatabasesEnum.place, - defaultValue: "bLand", - ), - // -------------------- - VarTextField( - textController: rmap["Lkr"]!["controller"]!, - localization: AppLocalizations.of(context)!.lkr, - dbName: "Lkr", - required: true, - dbDesignation: DatabasesEnum.place, - ), - // -------------------- - VarTextField( - textController: rmap["BeiOrt"]!["controller"]!, - localization: AppLocalizations.of(context)!.beiort, - dbName: "BeiOrt", - required: true, - dbDesignation: DatabasesEnum.place, - ), - // -------------------- - VarTextField( - textController: rmap["OrtInfo"]!["controller"]!, - localization: AppLocalizations.of(context)!.ortinfo, - dbName: "OrtInfo", - required: false, - dbDesignation: DatabasesEnum.place, - ), - const SizedBox(height: 15), - // -------------------- - Align( - alignment: Alignment.bottomLeft, - child: Row( - children: [ - Text(AppLocalizations.of(context)!.platzung), - const Text('*', style: TextStyle(color: Colors.red)), - ], - ), - ), - Platzung( - initialPlatzung: rmap["Platzung"]!["controller"]!.text, - onPlatzungChanged: (platzung) { - setState(() { - rmap["Platzung"]!["controller"]!.text = platzung; - }); - }, - ), - ], - ), - ), - // Third step - Step( - title: Text(AppLocalizations.of(context)!.thirdstep), - content: Column( - children: [ - Datum( - initDatum: DateTime.parse(rmap["Datum"]!["controller"]!.text), - onDateChanged: (value) { - rmap["Datum"]!["controller"]!.text = value; - }, - name: AppLocalizations.of(context)!.pickDate, - ), - // -------------------- - KontDat( - initKontDat: rmap["KontDat"]!["controller"]!.text == "" ? DateTime.now() : DateTime.parse(rmap["KontDat"]!["controller"]!.text), - onDateChanged: (value) { - setState(() { - rmap["KontDat"]!["controller"]!.text = - value.toString().split(" ").first; - }); - }, - ), - const SizedBox(height: 20), - // -------------------- - Align( - alignment: Alignment.bottomLeft, - child: Row( - children: [ - Text(AppLocalizations.of(context)!.ktage), - const Text('*', style: TextStyle(color: Colors.red)), - ], - ), - ), - Row( + ), + // Third step + Step( + title: Text(AppLocalizations.of(context)!.thirdstep), + content: Column( children: [ - Expanded(child: Text(AppLocalizations.of(context)!.ktage1)), - const SizedBox(width: 15), - Expanded( - flex: 4, - child: VarTextField( - otherDefault: "24", - textController: rmap["KTage1"]!["controller"]!, - localization: AppLocalizations.of(context)!.ktage1, - dbName: "KTage1", - required: true, - dbDesignation: DatabasesEnum.place, - ), - ), - ], - ), - Row( - children: [ - Expanded(child: Text(AppLocalizations.of(context)!.ktage2)), - const SizedBox(width: 15), - Expanded( - flex: 4, - child: VarTextField( - otherDefault: "48", - textController: rmap["KTage2"]!["controller"]!, - localization: AppLocalizations.of(context)!.ktage2, - dbName: "KTage2", - required: true, - dbDesignation: DatabasesEnum.place, - ), - ), - ], - ), - const SizedBox(height: 20), - // -------------------- - Row( - children: [ - AbbauDat( - initAbbauDat: rmap["AbbauDat"]!["controller"]!.text == "" ? null : DateTime.parse(rmap["AbbauDat"]!["controller"]!.text), + Datum( + initDatum: DateTime.parse(rmap["Datum"]!["controller"]!.text), onDateChanged: (value) { - rmap["AbbauDat"]!["controller"]!.text = - value.toString().split(" ").first; + setState(() { + rmap["Datum"]!["controller"]!.text = value.toString(); + }); }, + name: AppLocalizations.of(context)!.pickDate, + ), + // -------------------- + KontDat( + initKontDat: rmap["KontDat"]!["controller"]!.text == "" + ? DateTime.now() + : DateTime.parse(rmap["KontDat"]!["controller"]!.text), + onDateChanged: (value) { + setState(() { + rmap["KontDat"]!["controller"]!.text = + value.toString().split(" ").first; + }); + }, + ), + const SizedBox(height: 20), + // -------------------- + Align( + alignment: Alignment.bottomLeft, + child: Row( + children: [ + Text(AppLocalizations.of(context)!.ktage), + const Text('*', style: TextStyle(color: Colors.red)), + ], + ), + ), + Row( + children: [ + Expanded(child: Text(AppLocalizations.of(context)!.ktage1)), + const SizedBox(width: 15), + Expanded( + flex: 4, + child: VarTextField( + textController: rmap["KTage1"]!["controller"]!, + localization: AppLocalizations.of(context)!.ktage1, + dbName: "KTage1", + required: true, + dbDesignation: DatabasesEnum.place, + ), + ), + ], + ), + Row( + children: [ + Expanded(child: Text(AppLocalizations.of(context)!.ktage2)), + const SizedBox(width: 15), + Expanded( + flex: 4, + child: VarTextField( + textController: rmap["KTage2"]!["controller"]!, + localization: AppLocalizations.of(context)!.ktage2, + dbName: "KTage2", + required: true, + dbDesignation: DatabasesEnum.place, + ), + ), + ], + ), + const SizedBox(height: 20), + // -------------------- + Row( + children: [ + AbbauDat( + initAbbauDat: rmap["AbbauDat"]!["controller"]!.text == "" + ? null + : DateTime.parse( + rmap["AbbauDat"]!["controller"]!.text), + onDateChanged: (value) { + rmap["AbbauDat"]!["controller"]!.text = + value.toString().split(" ").first; + }, + ), + ], + ), + const SizedBox(height: 20), + // -------------------- + VarTextField( + textController: rmap["Auftrag"]!["controller"]!, + localization: AppLocalizations.of(context)!.auftrag, + dbName: "Auftrag", + required: false, + dbDesignation: DatabasesEnum.place, + ), + // -------------------- + VarTextField( + textController: rmap["KontAbsp"]!["controller"]!, + localization: AppLocalizations.of(context)!.kontabsp, + dbName: "KontAbsp", + required: false, + dbDesignation: DatabasesEnum.place, + ), + // -------------------- + VarTextField( + textController: rmap["SonstBem"]!["controller"]!, + localization: AppLocalizations.of(context)!.sonstbemerkungen, + dbName: "SonstBem", + dbDesignation: DatabasesEnum.place, + required: false, ), ], ), - const SizedBox(height: 20), - // -------------------- - VarTextField( - textController: rmap["Auftrag"]!["controller"]!, - localization: AppLocalizations.of(context)!.auftrag, - dbName: "Auftrag", - required: false, - dbDesignation: DatabasesEnum.place, + ), + // Fourth step + Step( + title: Text(AppLocalizations.of(context)!.fourthstep), + content: Column( + children: [ + VarTextField( + textController: rmap["Adresse1"]!["controller"]!, + localization: AppLocalizations.of(context)!.adresse1, + dbName: "Adresse1", + dbDesignation: DatabasesEnum.place, + required: true, + defaultValue: "addresse1", + ), + // -------------------- + VarTextField( + textController: rmap["Adresse2"]!["controller"]!, + localization: AppLocalizations.of(context)!.adresse2, + dbName: "Adresse2", + required: false, + dbDesignation: DatabasesEnum.place, + ), + // -------------------- + VarTextField( + textController: rmap["Adresse3"]!["controller"]!, + localization: AppLocalizations.of(context)!.adresse3, + dbName: "Adresse3", + required: false, + dbDesignation: DatabasesEnum.place, + ), + const SizedBox(height: 15), + // -------------------- + VarTextField( + textController: rmap["FKontakt1"]!["controller"]!, + localization: AppLocalizations.of(context)!.fkontakt1, + dbName: "FKontakt1", + required: false, + dbDesignation: DatabasesEnum.place, + ), + // -------------------- + VarTextField( + textController: rmap["FKontakt2"]!["controller"]!, + localization: AppLocalizations.of(context)!.fkontakt2, + dbName: "FKontakt2", + required: false, + dbDesignation: DatabasesEnum.place, + ), + // -------------------- + VarTextField( + textController: rmap["FKontakt3"]!["controller"]!, + localization: AppLocalizations.of(context)!.fkontakt3, + dbName: "FKontakt3", + required: false, + dbDesignation: DatabasesEnum.place, + ), + // -------------------- + VarTextField( + textController: rmap["IntKomm"]!["controller"]!, + localization: AppLocalizations.of(context)!.intkomm, + dbName: "IntKomm", + required: false, + dbDesignation: DatabasesEnum.place, + ), + ], ), - // -------------------- - VarTextField( - textController: rmap["KontAbsp"]!["controller"]!, - localization: AppLocalizations.of(context)!.kontabsp, - dbName: "KontAbsp", - required: false, - dbDesignation: DatabasesEnum.place, - ), - // -------------------- - VarTextField( - textController: rmap["SonstBem"]!["controller"]!, - localization: AppLocalizations.of(context)!.sonstbemerkungen, - dbName: "SonstBem", - dbDesignation: DatabasesEnum.place, - required: false, - ), - ], - ), - ), - // Fourth step - Step( - title: Text(AppLocalizations.of(context)!.fourthstep), - content: Column( - children: [ - VarTextField( - textController: rmap["Adresse1"]!["controller"]!, - localization: AppLocalizations.of(context)!.adresse1, - dbName: "Adresse1", - dbDesignation: DatabasesEnum.place, - required: true, - defaultValue: "addresse1", - ), - // -------------------- - VarTextField( - textController: rmap["Adresse2"]!["controller"]!, - localization: AppLocalizations.of(context)!.adresse2, - dbName: "Adresse2", - required: false, - dbDesignation: DatabasesEnum.place, - ), - // -------------------- - VarTextField( - textController: rmap["Adresse3"]!["controller"]!, - localization: AppLocalizations.of(context)!.adresse3, - dbName: "Adresse3", - required: false, - dbDesignation: DatabasesEnum.place, - ), - const SizedBox(height: 15), - // -------------------- - VarTextField( - textController: rmap["FKontakt1"]!["controller"]!, - localization: AppLocalizations.of(context)!.fkontakt1, - dbName: "FKontakt1", - required: false, - dbDesignation: DatabasesEnum.place, - ), - // -------------------- - VarTextField( - textController: rmap["FKontakt2"]!["controller"]!, - localization: AppLocalizations.of(context)!.fkontakt2, - dbName: "FKontakt2", - required: false, - dbDesignation: DatabasesEnum.place, - ), - // -------------------- - VarTextField( - textController: rmap["FKontakt3"]!["controller"]!, - localization: AppLocalizations.of(context)!.fkontakt3, - dbName: "FKontakt3", - required: false, - dbDesignation: DatabasesEnum.place, - ), - // -------------------- - VarTextField( - textController: rmap["IntKomm"]!["controller"]!, - localization: AppLocalizations.of(context)!.intkomm, - dbName: "IntKomm", - required: false, - dbDesignation: DatabasesEnum.place, - ), - ], - ), - ), - ]; + ), + ]; // Here the site is built with the steps from above return Scaffold( @@ -690,7 +695,6 @@ class _AddCamMainState extends State { currentStep += 1; }); } else { - if (widget.isSent) { Navigator.pushNamedAndRemoveUntil( context, @@ -702,14 +706,11 @@ class _AddCamMainState extends State { bool empty = CheckRequired.checkRequired(rmap); // TODO for debugging always false - empty = false; + empty = false; if (empty == true) { AddEntriesDialogHelper.showTemplateDialog( - context, - getFieldsText(), - DatabasesEnum.place - ); + context, getFieldsText(), DatabasesEnum.place); return; } else if (empty == false) { await AddEntriesDialogHelper.showSaveOptionsDialog( diff --git a/lib/screens/sharedWidgets/var_text_field.dart b/lib/screens/sharedWidgets/var_text_field.dart index 27d2c06..0f08645 100644 --- a/lib/screens/sharedWidgets/var_text_field.dart +++ b/lib/screens/sharedWidgets/var_text_field.dart @@ -10,7 +10,6 @@ class VarTextField extends StatefulWidget { final DatabasesEnum dbDesignation; final String dbName; final String? defaultValue; - final String? otherDefault; final bool required; const VarTextField({ @@ -21,7 +20,6 @@ class VarTextField extends StatefulWidget { required this.required, required this.dbDesignation, this.defaultValue, - this.otherDefault, }); @override @@ -39,10 +37,6 @@ class _VarTextFieldState extends State { _loadPref(); } - if (widget.otherDefault != null) { - widget.textController.text = widget.otherDefault!; - } - _loadData().then((e) => dbVar = e); }