fixed dates
This commit is contained in:
@@ -155,14 +155,15 @@ class Karte extends StatefulWidget {
|
||||
{super.key,
|
||||
required this.currentPosition,
|
||||
required this.onPositionChange,
|
||||
required this.beiOrtC, required this.ortInfoC});
|
||||
required this.beiOrtC,
|
||||
required this.ortInfoC});
|
||||
|
||||
@override
|
||||
KarteState createState() => KarteState();
|
||||
}
|
||||
|
||||
class KarteState extends State<Karte> {
|
||||
List<Marker> markers = [ ];
|
||||
List<Marker> markers = [];
|
||||
LatLng? selectedPosition;
|
||||
Position? updatedPosition;
|
||||
bool saveVisible = false;
|
||||
@@ -197,7 +198,7 @@ class KarteState extends State<Karte> {
|
||||
List<Placemark> placemarks = await placemarkFromCoordinates(
|
||||
selectedPosition!.latitude,
|
||||
selectedPosition!.longitude);
|
||||
print(placemarks);
|
||||
print(placemarks);
|
||||
|
||||
if (selectedPosition != null) {
|
||||
setState(() {
|
||||
@@ -293,16 +294,23 @@ class KarteState extends State<Karte> {
|
||||
// datum is the variable where the chosen date is stored
|
||||
|
||||
class Datum extends StatefulWidget {
|
||||
final DateTime? datum;
|
||||
final DateTime? initDatum;
|
||||
final Function(DateTime) onDateChanged;
|
||||
|
||||
const Datum({super.key, required this.datum});
|
||||
const Datum({super.key, required this.initDatum, required this.onDateChanged});
|
||||
|
||||
@override
|
||||
State<Datum> createState() => _DatumState();
|
||||
}
|
||||
|
||||
class _DatumState extends State<Datum> {
|
||||
DateTime? datum = DateTime.now();
|
||||
DateTime? datum;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
datum = widget.initDatum;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -316,6 +324,7 @@ class _DatumState extends State<Datum> {
|
||||
final date = await pickDate();
|
||||
if (date == null) return;
|
||||
setState(() => datum = date);
|
||||
widget.onDateChanged(date);
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.pickDate)),
|
||||
),
|
||||
@@ -336,14 +345,8 @@ class _DatumState extends State<Datum> {
|
||||
initialDate: datum!,
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime(5000));
|
||||
if (date == null) return null;
|
||||
setState(() => datum = date);
|
||||
|
||||
var place = {'Datum': DateFormat('yyyy-MM-dd').format(datum!)};
|
||||
|
||||
await DBHelper().addPlace(place);
|
||||
|
||||
return datum;
|
||||
return date;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -473,11 +476,11 @@ class Platzung extends StatefulWidget {
|
||||
final Function(String) onPlatzungChanged;
|
||||
final String? initialPlatzung;
|
||||
|
||||
|
||||
const Platzung(
|
||||
{super.key,
|
||||
required this.onPlatzungChanged, this.initialPlatzung,
|
||||
});
|
||||
const Platzung({
|
||||
super.key,
|
||||
required this.onPlatzungChanged,
|
||||
this.initialPlatzung,
|
||||
});
|
||||
|
||||
@override
|
||||
State<Platzung> createState() => _PlatzungState();
|
||||
@@ -494,7 +497,6 @@ class _PlatzungState extends State<Platzung> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
@@ -725,16 +727,24 @@ class _MEZState extends State<MEZ> {
|
||||
// KontDat
|
||||
|
||||
class KontDat extends StatefulWidget {
|
||||
final DateTime? kontDat;
|
||||
final DateTime? initKontDat;
|
||||
final Function(DateTime) onDateChanged;
|
||||
|
||||
const KontDat({super.key, required this.kontDat});
|
||||
const KontDat(
|
||||
{super.key, required this.initKontDat, required this.onDateChanged});
|
||||
|
||||
@override
|
||||
State<KontDat> createState() => _KontDatState();
|
||||
}
|
||||
|
||||
class _KontDatState extends State<KontDat> {
|
||||
DateTime? kontDat = DateTime.now();
|
||||
DateTime? kontDat;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
kontDat = widget.initKontDat;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -747,7 +757,10 @@ class _KontDatState extends State<KontDat> {
|
||||
onPressed: () async {
|
||||
final date = await pickDate();
|
||||
if (date == null) return;
|
||||
setState(() => kontDat = date);
|
||||
setState(() {
|
||||
kontDat = date;
|
||||
});
|
||||
widget.onDateChanged(date);
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.pickkontdat)),
|
||||
),
|
||||
@@ -765,26 +778,21 @@ class _KontDatState extends State<KontDat> {
|
||||
Future<DateTime?> pickDate() async {
|
||||
final date = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: kontDat!,
|
||||
initialDate: kontDat ?? DateTime.now(),
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime(5000));
|
||||
if (date == null) return null;
|
||||
setState(() => kontDat = date);
|
||||
|
||||
var place = {'KontDat': DateFormat('yyyy-MM-dd').format(kontDat!)};
|
||||
|
||||
await DBHelper().addPlace(place);
|
||||
|
||||
return kontDat;
|
||||
return date;
|
||||
}
|
||||
}
|
||||
|
||||
// AbbauDat
|
||||
|
||||
class AbbauDat extends StatefulWidget {
|
||||
final DateTime? abbauDat;
|
||||
final DateTime? initAbbauDat;
|
||||
final Function(DateTime) onDateChanged;
|
||||
|
||||
const AbbauDat({super.key, required this.abbauDat});
|
||||
const AbbauDat({super.key, required this.initAbbauDat, required this.onDateChanged});
|
||||
|
||||
@override
|
||||
State<AbbauDat> createState() => _AbbauDatState();
|
||||
@@ -793,6 +801,12 @@ class AbbauDat extends StatefulWidget {
|
||||
class _AbbauDatState extends State<AbbauDat> {
|
||||
DateTime? abbauDat;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
abbauDat = widget.initAbbauDat;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
@@ -805,6 +819,7 @@ class _AbbauDatState extends State<AbbauDat> {
|
||||
final date = await pickDate();
|
||||
if (date == null) return;
|
||||
setState(() => abbauDat = date);
|
||||
widget.onDateChanged(date);
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.pickabbaudat)),
|
||||
),
|
||||
@@ -841,7 +856,6 @@ class _AbbauDatState extends State<AbbauDat> {
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime(5000));
|
||||
if (date == null) return null;
|
||||
setState(() => abbauDat = date);
|
||||
|
||||
return abbauDat;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user