repaired everything hopefully

This commit is contained in:
Nico
2025-06-06 17:31:47 +02:00
parent 775b7ce0e7
commit 7d85090d4e
2 changed files with 443 additions and 448 deletions

View File

@@ -55,7 +55,6 @@ class _AddCamMainState extends State<AddCamMain> {
headingAccuracy: 0.0,
);
Map<String, Map<String, dynamic>> rmap = {
"ID": {"controller": TextEditingController(), "required": false},
// Step 1
@@ -177,8 +176,7 @@ class _AddCamMainState extends State<AddCamMain> {
rmap["DECLNG"]!["controller"]!.text = currentPosition.longitude.toString();
// Try to get current position
GeolocatorService.deteterminePosition()
.then((result) {
GeolocatorService.deteterminePosition().then((result) {
if (mounted) {
setState(() {
currentPosition = result;
@@ -187,8 +185,7 @@ class _AddCamMainState extends State<AddCamMain> {
rmap["DECLNG"]!["controller"]!.text = result.longitude.toString();
});
}
})
.catchError((error) {
}).catchError((error) {
if (error is LocationDisabledException) {
if (mounted) {
SnackBarHelper.showSnackBarMessage(
@@ -386,8 +383,10 @@ class _AddCamMainState extends State<AddCamMain> {
speed: 0.0,
speedAccuracy: 0.0,
);
rmap["DECLAT"]!["controller"]!.text = result.latitude.toString();
rmap["DECLNG"]!["controller"]!.text = result.longitude.toString();
rmap["DECLAT"]!["controller"]!.text =
result.latitude.toString();
rmap["DECLNG"]!["controller"]!.text =
result.longitude.toString();
isLoadingPosition = false;
});
} else if (mounted) {
@@ -405,7 +404,8 @@ class _AddCamMainState extends State<AddCamMain> {
height: 16,
child: CircularProgressIndicator(
strokeWidth: 2,
color: Theme.of(context).colorScheme.onPrimary,
color:
Theme.of(context).colorScheme.onPrimary,
),
),
const SizedBox(width: 8),
@@ -479,13 +479,17 @@ class _AddCamMainState extends State<AddCamMain> {
Datum(
initDatum: DateTime.parse(rmap["Datum"]!["controller"]!.text),
onDateChanged: (value) {
rmap["Datum"]!["controller"]!.text = value;
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),
initKontDat: rmap["KontDat"]!["controller"]!.text == ""
? DateTime.now()
: DateTime.parse(rmap["KontDat"]!["controller"]!.text),
onDateChanged: (value) {
setState(() {
rmap["KontDat"]!["controller"]!.text =
@@ -511,7 +515,6 @@ class _AddCamMainState extends State<AddCamMain> {
Expanded(
flex: 4,
child: VarTextField(
otherDefault: "24",
textController: rmap["KTage1"]!["controller"]!,
localization: AppLocalizations.of(context)!.ktage1,
dbName: "KTage1",
@@ -528,7 +531,6 @@ class _AddCamMainState extends State<AddCamMain> {
Expanded(
flex: 4,
child: VarTextField(
otherDefault: "48",
textController: rmap["KTage2"]!["controller"]!,
localization: AppLocalizations.of(context)!.ktage2,
dbName: "KTage2",
@@ -543,7 +545,10 @@ class _AddCamMainState extends State<AddCamMain> {
Row(
children: [
AbbauDat(
initAbbauDat: rmap["AbbauDat"]!["controller"]!.text == "" ? null : DateTime.parse(rmap["AbbauDat"]!["controller"]!.text),
initAbbauDat: rmap["AbbauDat"]!["controller"]!.text == ""
? null
: DateTime.parse(
rmap["AbbauDat"]!["controller"]!.text),
onDateChanged: (value) {
rmap["AbbauDat"]!["controller"]!.text =
value.toString().split(" ").first;
@@ -690,7 +695,6 @@ class _AddCamMainState extends State<AddCamMain> {
currentStep += 1;
});
} else {
if (widget.isSent) {
Navigator.pushNamedAndRemoveUntil(
context,
@@ -706,10 +710,7 @@ class _AddCamMainState extends State<AddCamMain> {
if (empty == true) {
AddEntriesDialogHelper.showTemplateDialog(
context,
getFieldsText(),
DatabasesEnum.place
);
context, getFieldsText(), DatabasesEnum.place);
return;
} else if (empty == false) {
await AddEntriesDialogHelper.showSaveOptionsDialog(

View File

@@ -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<VarTextField> {
_loadPref();
}
if (widget.otherDefault != null) {
widget.textController.text = widget.otherDefault!;
}
_loadData().then((e) => dbVar = e);
}