fixed dates

This commit is contained in:
2024-05-09 11:12:39 +02:00
parent 3e3113c1cc
commit ec03b32ce6
2 changed files with 113 additions and 82 deletions

View File

@@ -185,8 +185,12 @@ class _AddCamMainState extends State<AddCamMain> {
selectedPlatzung = widget.existingData!['Platzung'] ?? "";
kSchloNrC.text = widget.existingData!['KSchloNr'] ?? "";
datum = DateTime.parse(widget.existingData!['Datum']);
kontDat = widget.existingData!['KontDat'] == null ? null : DateTime.parse(widget.existingData!['KontDat']);
abbauDat = widget.existingData!['AbbauDat'] == null ? null : DateTime.parse(widget.existingData!['AbbauDat']);
kontDat = widget.existingData!['KontDat'] == null
? null
: DateTime.parse(widget.existingData!['KontDat']);
abbauDat = widget.existingData!['AbbauDat'] == null
? null
: DateTime.parse(widget.existingData!['AbbauDat']);
auftragC.text = widget.existingData!['Auftrag'] ?? "";
kontAbspC.text = widget.existingData!['KontAbsp'] ?? "";
sonstBemC.text = widget.existingData!['SonstBem'] ?? "";
@@ -196,7 +200,9 @@ class _AddCamMainState extends State<AddCamMain> {
standortC.text = widget.existingData!['Standort'] ?? "";
kTage1C.text = widget.existingData!['KTage1'].toString();
kTage2C.text = widget.existingData!['KTage2'].toString();
protoAm = widget.existingData!['ProtoAm'] == null ? null : DateTime.parse(widget.existingData!['ProtoAm']);
protoAm = widget.existingData!['ProtoAm'] == null
? null
: DateTime.parse(widget.existingData!['ProtoAm']);
intKommC.text = widget.existingData!['IntKomm'] ?? "";
betreuungC.text = widget.existingData!['Betreuung'] ?? "";
}
@@ -240,8 +246,6 @@ class _AddCamMainState extends State<AddCamMain> {
actions: [
TextButton(
onPressed: () async {
int errorCode = _httpRequest();
if (errorCode != 201) {
@@ -279,7 +283,6 @@ class _AddCamMainState extends State<AddCamMain> {
child: Text(AppLocalizations.of(context)!.template)),
TextButton(
onPressed: () async {
int errorCode = _httpRequest();
if (errorCode != 201) {
@@ -341,7 +344,6 @@ class _AddCamMainState extends State<AddCamMain> {
}
int _httpRequest() {
Map<String, dynamic> place = getPlace();
Methods method = Methods();
@@ -566,47 +568,47 @@ class _AddCamMainState extends State<AddCamMain> {
children: [
Column(
children: [
Text(currentPosition.latitude.toString()),
Text(currentPosition.longitude.toString()),
Text(currentPosition.latitude.toString()),
Text(currentPosition.longitude.toString()),
],
),
const SizedBox(width: 15,),
ElevatedButton(
onPressed: () async {
final result = await Navigator.of(context)
.push<LatLng>(
MaterialPageRoute(builder: (context) {
return Karte(
ortInfoC: ortInfoC,
beiOrtC: beiOrtC,
currentPosition: currentPosition,
onPositionChange: (updatedPosition) {
setState(() {
currentPosition = updatedPosition;
});
},
);
}));
if (result != null) {
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,
const SizedBox(
width: 15,
),
ElevatedButton(
onPressed: () async {
final result = await Navigator.of(context)
.push<LatLng>(
MaterialPageRoute(builder: (context) {
return Karte(
ortInfoC: ortInfoC,
beiOrtC: beiOrtC,
currentPosition: currentPosition,
onPositionChange: (updatedPosition) {
setState(() {
currentPosition = updatedPosition;
});
},
);
});
}
},
child: Text(AppLocalizations.of(context)!.openMap)),
}));
if (result != null) {
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,
);
});
}
},
child: Text(AppLocalizations.of(context)!.openMap)),
],
),
VarTextField(
@@ -661,9 +663,19 @@ class _AddCamMainState extends State<AddCamMain> {
content: Column(
children: [
Datum(
datum: datum,
initDatum: datum,
onDateChanged: (value) {
datum = value;
},
),
KontDat(
initKontDat: kontDat,
onDateChanged: (value) {
setState(() {
kontDat = value;
});
},
),
KontDat(kontDat: kontDat),
const SizedBox(
height: 20,
),
@@ -712,7 +724,12 @@ class _AddCamMainState extends State<AddCamMain> {
),
Row(
children: [
AbbauDat(abbauDat: abbauDat),
AbbauDat(
initAbbauDat: abbauDat,
onDateChanged: (value) {
abbauDat = value;
},
),
],
),
const SizedBox(