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

View File

@@ -10,7 +10,6 @@ class VarTextField extends StatefulWidget {
final DatabasesEnum dbDesignation; final DatabasesEnum dbDesignation;
final String dbName; final String dbName;
final String? defaultValue; final String? defaultValue;
final String? otherDefault;
final bool required; final bool required;
const VarTextField({ const VarTextField({
@@ -21,7 +20,6 @@ class VarTextField extends StatefulWidget {
required this.required, required this.required,
required this.dbDesignation, required this.dbDesignation,
this.defaultValue, this.defaultValue,
this.otherDefault,
}); });
@override @override
@@ -39,10 +37,6 @@ class _VarTextFieldState extends State<VarTextField> {
_loadPref(); _loadPref();
} }
if (widget.otherDefault != null) {
widget.textController.text = widget.otherDefault!;
}
_loadData().then((e) => dbVar = e); _loadData().then((e) => dbVar = e);
} }