sitzung luc

This commit is contained in:
nico
2024-03-21 21:22:29 +01:00
parent bfabdee84b
commit d1ce04d2d0
11 changed files with 444 additions and 579 deletions

View File

@@ -7,17 +7,24 @@ beim nächsten schritt als template
im englischen abändern im englischen abändern
standort automatisch in Karte standort automatisch in Karte
karte drehen aus karte drehen aus
Auftrag absätze machen und textfeld größer wenn langer text Überall absätze machen und textfeld größer wenn langer text
beim letzten weiter alle leeren felder anzeigen (array zurückgeben) beim letzten weiter alle leeren felder anzeigen (array zurückgeben)
gespeicherten ordner anzeigen gespeicherten ordner anzeigen
zurückfeld in datenansicht zurückfeld in datenansicht
überschriften für view cams überschriften für view cams
null eintrag in dropdown menüs weg dropdown menü fixen
speichern funktion zum Abbrechen speichern funktion zum Abbrechen
fehler beim speichern anzeigen fehler beim speichern anzeigen
place variable ein mal deklarieren in add_cam_main
nach koordinaten lkr auswählen (esri-leaflet-geocoder) nach koordinaten lkr auswählen (esri-leaflet-geocoder)
nach screenshots sortieren nach screenshots sortieren
dropdown button in add_cam_main fixen
schritte latlang umbenennen
fix ktage und nebeneinander positioniere
wenn alles ausgefüllt trotzdem als template speichern
textdateien auch an server senden
ausvon und ausbis fixen (falsches datum übergeben (20000-01-01))
not to do: not to do:

View File

@@ -10,8 +10,8 @@ import 'package:geolocator/geolocator.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:latlong2/latlong.dart'; import 'package:latlong2/latlong.dart';
import 'package:animations/animations.dart'; import 'package:animations/animations.dart';
import 'package:http/http.dart' as http;
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:shared_preferences/shared_preferences.dart';
class AddCamMain extends StatefulWidget { class AddCamMain extends StatefulWidget {
final bool isTemplate; final bool isTemplate;
@@ -30,9 +30,9 @@ class _AddCamMainState extends State<AddCamMain> {
TextEditingController id = TextEditingController(); TextEditingController id = TextEditingController();
TextEditingController rudelC = TextEditingController(); TextEditingController rudelC = TextEditingController();
TextEditingController nameVornameC = TextEditingController(); TextEditingController addresse1C = TextEditingController();
TextEditingController plzOrtC = TextEditingController(); TextEditingController addresse2C = TextEditingController();
TextEditingController emailTelC = TextEditingController(); TextEditingController addresse3C = TextEditingController();
TextEditingController bLandC = TextEditingController(); TextEditingController bLandC = TextEditingController();
TextEditingController lkrC = TextEditingController(); TextEditingController lkrC = TextEditingController();
TextEditingController beiOrtC = TextEditingController(); TextEditingController beiOrtC = TextEditingController();
@@ -49,14 +49,14 @@ class _AddCamMainState extends State<AddCamMain> {
TextEditingController kTage1C = TextEditingController(); TextEditingController kTage1C = TextEditingController();
TextEditingController kTage2C = TextEditingController(); TextEditingController kTage2C = TextEditingController();
TextEditingController intKommC = TextEditingController(); TextEditingController intKommC = TextEditingController();
TextEditingController kontSumC = TextEditingController(); TextEditingController betreuungC = TextEditingController();
String selectedStatus = 'aktiv'; String selectedStatus = 'aktiv';
String selectedSTTyp = 'opportunistisch'; String selectedSTTyp = 'opportunistisch';
String selectedFotoFilm = 'foto'; String selectedFotoFilm = 'Foto';
String selectedMEZ = 'sommerzeit'; String selectedMEZ = 'Sommerzeit';
String selectedPlatzung = 'kirrung'; String selectedPlatzung = 'Kirrung';
String selectedBearsafe = 'nein'; String selectedBearsafe = 'Nein';
Position currentPosition = Position( Position currentPosition = Position(
longitude: 10.0, longitude: 10.0,
@@ -83,6 +83,49 @@ class _AddCamMainState extends State<AddCamMain> {
DateTime kontDat = DateTime.now(); DateTime kontDat = DateTime.now();
DateTime protoAm = DateTime.now(); DateTime protoAm = DateTime.now();
Map<String, dynamic> getPlace() {
Map<String, dynamic> place = {
'CID': id.text,
'Rudel': rudelC.text,
'Datum': datumS,
'Adresse1': addresse1C.text,
'Adresse2': addresse2C.text,
'Adresse3': addresse3C.text,
'BLand': bLandC.text,
'Lkr': lkrC.text,
'BeiOrt': beiOrtC.text,
'OrtInfo': ortInfoC.text,
'Status': selectedStatus,
'STTyp': selectedSTTyp,
'FFTyp': ffTypC.text,
'FotoFilm': selectedFotoFilm,
'MEZ': selectedMEZ,
'Platzung': selectedPlatzung,
'KSchloNr': kSchloNrC.text,
'Bearsafe': selectedBearsafe,
'KontDat': kontDatS,
'AbbauDat': abbauDatS,
'Auftrag': auftragC.text,
'KontAbsp': absprachenC.text,
'SonstBem': sonstBemerkungenC.text,
'FKontakt1': fKontakt1C.text,
'FKontakt2': fKontakt2C.text,
'FKontakt3': fKontakt3C.text,
'Standort': altStOrtC.text,
'AusVon': ausVonS,
'AusBis': ausBisS,
'KTage1': kTage1C.text,
'KTage2': kTage2C.text,
'ProtoAm': protoAmS,
'IntKomm': intKommC.text,
'Betreuung': betreuungC.text,
'DECLNG': currentPosition.longitude,
'DECLAT': currentPosition.latitude,
};
return place;
}
bool empty = false; bool empty = false;
// determine live position with checks for denied permission and turned off location service // determine live position with checks for denied permission and turned off location service
@@ -137,9 +180,9 @@ class _AddCamMainState extends State<AddCamMain> {
if (widget.isTemplate && widget.templateData != null) { if (widget.isTemplate && widget.templateData != null) {
id.text = widget.templateData!['CID']; id.text = widget.templateData!['CID'];
rudelC.text = widget.templateData!['Rudel']; rudelC.text = widget.templateData!['Rudel'];
nameVornameC.text = widget.templateData!['NameVorname']; addresse1C.text = widget.templateData!['Addresse1'];
plzOrtC.text = widget.templateData!['PLZOrt']; addresse2C.text = widget.templateData!['Addresse2'];
emailTelC.text = widget.templateData!['EmailTel']; addresse3C.text = widget.templateData!['Addresse3'];
bLandC.text = widget.templateData!['BLand']; bLandC.text = widget.templateData!['BLand'];
lkrC.text = widget.templateData!['Lkr']; lkrC.text = widget.templateData!['Lkr'];
beiOrtC.text = widget.templateData!['BeiOrt']; beiOrtC.text = widget.templateData!['BeiOrt'];
@@ -168,7 +211,7 @@ class _AddCamMainState extends State<AddCamMain> {
kTage2C.text = widget.templateData!['KTage2'].toString(); kTage2C.text = widget.templateData!['KTage2'].toString();
protoAmS = widget.templateData!['ProtoAm']; protoAmS = widget.templateData!['ProtoAm'];
intKommC.text = widget.templateData!['IntKomm']; intKommC.text = widget.templateData!['IntKomm'];
kontSumC.text = widget.templateData!['KontSum']; betreuungC.text = widget.templateData!['Betreuung'];
} }
} }
@@ -228,42 +271,7 @@ class _AddCamMainState extends State<AddCamMain> {
} }
void _httpRequest() async { void _httpRequest() async {
Map<String, dynamic> place = { Map<String, dynamic> place = getPlace();
'CID': id.text,
'Rudel': rudelC.text,
'Datum': datumS,
'NameVorname': nameVornameC.text,
'PLZOrt': plzOrtC.text,
'EmailTel': emailTelC.text,
'BLand': bLandC.text,
'Lkr': lkrC.text,
'BeiOrt': beiOrtC.text,
'OrtInfo': ortInfoC.text,
'Status': selectedStatus,
'STTyp': selectedSTTyp,
'FFTyp': ffTypC.text,
'FotoFilm': selectedFotoFilm,
'MEZ': selectedMEZ,
'Platzung': selectedPlatzung,
'KSchloNr': kSchloNrC.text,
'Bearsafe': selectedBearsafe,
'KontDat': kontDatS,
'AbbauDat': abbauDatS,
'Auftrag': auftragC.text,
'Absprachen': absprachenC.text,
'SonstBemerkungen': sonstBemerkungenC.text,
'FKontakt1': fKontakt1C.text,
'FKontakt2': fKontakt2C.text,
'FKontakt3': fKontakt3C.text,
'AltStOrt': altStOrtC.text,
'AusVon': ausVonS,
'AusBis': ausBisS,
'KTage1': kTage1C.text,
'KTage2': kTage2C.text,
'ProtoAm': protoAmS,
'IntKomm': intKommC.text,
'KontSum': kontSumC.text,
};
/* final response = await http.post( /* final response = await http.post(
Uri.parse('http://192.168.1.106/www.dbb-wolf.de/data/_app24.php'), Uri.parse('http://192.168.1.106/www.dbb-wolf.de/data/_app24.php'),
@@ -276,13 +284,14 @@ class _AddCamMainState extends State<AddCamMain> {
print(jsonEncode(place)); print(jsonEncode(place));
final dio = Dio(); final dio = Dio();
final SharedPreferences prefs = await SharedPreferences.getInstance();
dio.options.responseType = ResponseType.plain; dio.options.responseType = ResponseType.plain;
Response response = Response response =
Response(requestOptions: RequestOptions(path: ''), statusCode: 400); Response(requestOptions: RequestOptions(path: ''), statusCode: 400);
try { try {
response = await dio.post( response = await dio.post(prefs.getString('apiAddress') ?? "",
'http://192.168.1.106/www.dbb-wolf.de/data/_app24.php',
data: jsonEncode(place)); data: jsonEncode(place));
} on DioException catch (e) { } on DioException catch (e) {
if (e.response?.statusCode == 500) { if (e.response?.statusCode == 500) {
@@ -302,42 +311,8 @@ class _AddCamMainState extends State<AddCamMain> {
Future<void> saveFile() async { Future<void> saveFile() async {
String? selectedDirectory = await FilePicker.platform.getDirectoryPath(); String? selectedDirectory = await FilePicker.platform.getDirectoryPath();
Map<String, dynamic> place = { Map place = getPlace();
'CID': id.text,
'Rudel': rudelC.text,
'Datum': datumS,
'NameVorname': nameVornameC.text,
'PLZOrt': plzOrtC.text,
'EmailTel': emailTelC.text,
'BLand': bLandC.text,
'Lkr': lkrC.text,
'BeiOrt': beiOrtC.text,
'OrtInfo': ortInfoC.text,
'Status': selectedStatus,
'STTyp': selectedSTTyp,
'FFTyp': ffTypC.text,
'FotoFilm': selectedFotoFilm,
'MEZ': selectedMEZ,
'Platzung': selectedPlatzung,
'KSchloNr': kSchloNrC.text,
'Bearsafe': selectedBearsafe,
'KontDat': kontDatS,
'AbbauDat': abbauDatS,
'Auftrag': auftragC.text,
'Absprachen': absprachenC.text,
'SonstBemerkungen': sonstBemerkungenC.text,
'FKontakt1': fKontakt1C.text,
'FKontakt2': fKontakt2C.text,
'FKontakt3': fKontakt3C.text,
'AltStOrt': altStOrtC.text,
'AusVon': ausVonS,
'AusBis': ausBisS,
'KTage1': kTage1C.text,
'KTage2': kTage2C.text,
'ProtoAm': protoAmS,
'IntKomm': intKommC.text,
'KontSum': kontSumC.text,
};
String jsonPlace = jsonEncode(place); String jsonPlace = jsonEncode(place);
if (selectedDirectory == null) { if (selectedDirectory == null) {
@@ -358,7 +333,7 @@ class _AddCamMainState extends State<AddCamMain> {
Map<String, TextEditingController> fields = { Map<String, TextEditingController> fields = {
'CID': id, 'CID': id,
'Rudel': rudelC, 'Rudel': rudelC,
'NameVorname': nameVornameC, 'Addresse1': addresse1C,
'BLand': bLandC, 'BLand': bLandC,
'Lkr': lkrC, 'Lkr': lkrC,
'BeiOrt': beiOrtC, 'BeiOrt': beiOrtC,
@@ -370,6 +345,7 @@ class _AddCamMainState extends State<AddCamMain> {
'Platzung': TextEditingController(text: selectedPlatzung), 'Platzung': TextEditingController(text: selectedPlatzung),
'KTage1': kTage1C, 'KTage1': kTage1C,
'KTage2': kTage2C, 'KTage2': kTage2C,
'Standort': altStOrtC,
}; };
for (var entry in fields.entries) { for (var entry in fields.entries) {
@@ -388,42 +364,8 @@ class _AddCamMainState extends State<AddCamMain> {
// If the user already edits a template this template will be upadted otherwise a new one will be created // If the user already edits a template this template will be upadted otherwise a new one will be created
void saveTemplate() async { void saveTemplate() async {
var placeDB = DBHelper(); var placeDB = DBHelper();
Map<String, dynamic> templates = {
'CID': id.text, Map<String, dynamic> templates = getPlace();
'Rudel': rudelC.text,
'Datum': datumS,
'NameVorname': nameVornameC.text,
'PLZOrt': plzOrtC.text,
'EmailTel': emailTelC.text,
'BLand': bLandC.text,
'Lkr': lkrC.text,
'BeiOrt': beiOrtC.text,
'OrtInfo': ortInfoC.text,
'Status': selectedStatus,
'STTyp': selectedSTTyp,
'FFTyp': ffTypC.text,
'FotoFilm': selectedFotoFilm,
'MEZ': selectedMEZ,
'Platzung': selectedPlatzung,
'KSchloNr': kSchloNrC.text,
'Bearsafe': selectedBearsafe,
'KontDat': kontDatS,
'AbbauDat': abbauDatS,
'Auftrag': auftragC.text,
'Absprachen': absprachenC.text,
'SonstBemerkungen': sonstBemerkungenC.text,
'FKontakt1': fKontakt1C.text,
'FKontakt2': fKontakt2C.text,
'FKontakt3': fKontakt3C.text,
'AltStOrt': altStOrtC.text,
'AusVon': ausVonS,
'AusBis': ausBisS,
'KTage1': kTage1C.text,
'KTage2': kTage2C.text,
'ProtoAm': protoAmS,
'IntKomm': intKommC.text,
'KontSum': kontSumC.text,
};
if (widget.isTemplate) { if (widget.isTemplate) {
await placeDB.updateTemplate(templates); await placeDB.updateTemplate(templates);
@@ -436,42 +378,8 @@ class _AddCamMainState extends State<AddCamMain> {
// * also creates a json string to send it to the server later // * also creates a json string to send it to the server later
void saveData() async { void saveData() async {
var placeDB = DBHelper(); var placeDB = DBHelper();
Map<String, dynamic> place = {
'CID': id.text, Map<String, dynamic> place = getPlace();
'Rudel': rudelC.text,
'Datum': datumS,
'NameVorname': nameVornameC.text,
'PLZOrt': plzOrtC.text,
'EmailTel': emailTelC.text,
'BLand': bLandC.text,
'Lkr': lkrC.text,
'BeiOrt': beiOrtC.text,
'OrtInfo': ortInfoC.text,
'Status': selectedStatus,
'STTyp': selectedSTTyp,
'FFTyp': ffTypC.text,
'FotoFilm': selectedFotoFilm,
'MEZ': selectedMEZ,
'Platzung': selectedPlatzung,
'KSchloNr': kSchloNrC.text,
'Bearsafe': selectedBearsafe,
'KontDat': kontDatS,
'AbbauDat': abbauDatS,
'Auftrag': auftragC.text,
'Absprachen': absprachenC.text,
'SonstBemerkungen': sonstBemerkungenC.text,
'FKontakt1': fKontakt1C.text,
'FKontakt2': fKontakt2C.text,
'FKontakt3': fKontakt3C.text,
'AltStOrt': altStOrtC.text,
'AusVon': ausVonS,
'AusBis': ausBisS,
'KTage1': kTage1C.text,
'KTage2': kTage2C.text,
'ProtoAm': protoAmS,
'IntKomm': intKommC.text,
'KontSum': kontSumC.text,
};
await placeDB.addPlace(place); await placeDB.addPlace(place);
} }
@@ -490,32 +398,19 @@ class _AddCamMainState extends State<AddCamMain> {
alignment: Alignment.bottomLeft, alignment: Alignment.bottomLeft,
child: AltStOrt(altStOrtC: altStOrtC), child: AltStOrt(altStOrtC: altStOrtC),
), ),
CamId(id: id),
Align(
alignment: Alignment.bottomLeft,
child: FFTyp(ffTypC: ffTypC),
),
Rudel(rudelC: rudelC),
const SizedBox( const SizedBox(
height: 15, height: 1,
), ),
Align( STTyp(
alignment: Alignment.bottomLeft, initialSTTyp: selectedSTTyp,
child: Row( onSTTypChanged: (sttyp) {
children: [
Text(AppLocalizations.of(context)!.bearsafe),
],
)),
Bearsafe(
initialBearsafe: selectedBearsafe,
onBearsafeChanged: (bearsafe) {
setState(() { setState(() {
selectedBearsafe = bearsafe; selectedSTTyp = sttyp;
}); });
}, },
), ),
const SizedBox( const SizedBox(
height: 15, height: 5,
), ),
Align( Align(
alignment: Alignment.bottomLeft, alignment: Alignment.bottomLeft,
@@ -536,116 +431,18 @@ class _AddCamMainState extends State<AddCamMain> {
}); });
}, },
), ),
Betreuung(betreuungC: betreuungC),
const SizedBox( const SizedBox(
height: 15, height: 20,
), ),
CamId(id: id),
Align( Align(
alignment: Alignment.bottomLeft, alignment: Alignment.bottomLeft,
child: Row( child: FFTyp(ffTypC: ffTypC),
children: [
Text(AppLocalizations.of(context)!.sttyp),
const Text(
'*',
style: TextStyle(color: Colors.red),
)
],
)),
STTyp(
initialSTTyp: selectedSTTyp,
onSTTypChanged: (sttyp) {
setState(() {
selectedSTTyp = sttyp;
});
},
), ),
const SizedBox( const SizedBox(
height: 15, height: 15,
), ),
Align(
alignment: Alignment.bottomLeft,
child: Row(
children: [
Text(
'${AppLocalizations.of(context)!.foto} ${AppLocalizations.of(context)!.film}'),
const Text(
'*',
style: TextStyle(color: Colors.red),
)
],
)),
FotoFilm(
initialFotoFilm: selectedFotoFilm,
onFotoFilmChanged: (fotofilm) {
setState(() {
selectedFotoFilm = fotofilm;
});
},
),
Align(
alignment: Alignment.bottomLeft,
child: KSchloNr(kSchloNrC: kSchloNrC),
),
const SizedBox(
height: 20,
),
Align(
alignment: Alignment.bottomLeft,
child: Row(
children: [
Text(AppLocalizations.of(context)!.ktage1),
const Text(
'*',
style: TextStyle(color: Colors.red),
)
],
),
),
KTage1(kTage1C: kTage1C),
const SizedBox(
height: 20,
),
Align(
alignment: Alignment.bottomLeft,
child: Row(
children: [
Text(AppLocalizations.of(context)!.ktage2),
const Text(
'*',
style: TextStyle(color: Colors.red),
)
],
)),
KTage2(kTage2C: kTage2C),
],
)),
// Date Step
Step(
title: Text(AppLocalizations.of(context)!.date),
content: Column(
children: [
Datum(
datum: datum,
),
const SizedBox(
height: 20,
),
KontDat(kontDat: kontDat),
const SizedBox(
height: 20,
),
AbbauDat(abbauDat: abbauDat),
const SizedBox(
height: 20,
),
AusVon(ausVon: ausVon),
const SizedBox(
height: 20,
),
AusBis(ausBis: ausBis),
const SizedBox(
height: 20,
),
Align( Align(
alignment: Alignment.bottomLeft, alignment: Alignment.bottomLeft,
child: Row( child: Row(
@@ -665,9 +462,38 @@ class _AddCamMainState extends State<AddCamMain> {
}); });
}, },
), ),
KontSum(kontSumC: kontSumC), Align(
alignment: Alignment.bottomLeft,
child: Row(
children: [
Text(AppLocalizations.of(context)!.bearsafe),
],
)),
Bearsafe(
initialBearsafe: selectedBearsafe,
onBearsafeChanged: (bearsafe) {
setState(() {
selectedBearsafe = bearsafe;
});
},
),
const SizedBox(
height: 15,
),
Align(
alignment: Alignment.bottomLeft,
child: KSchloNr(kSchloNrC: kSchloNrC),
),
const SizedBox(
height: 5,
),
Rudel(rudelC: rudelC),
const SizedBox(
height: 15,
),
], ],
)), )),
// Second step (location) // Second step (location)
Step( Step(
title: Text(AppLocalizations.of(context)!.locations), title: Text(AppLocalizations.of(context)!.locations),
@@ -714,10 +540,6 @@ class _AddCamMainState extends State<AddCamMain> {
}, },
child: Text(AppLocalizations.of(context)!.openMap)), child: Text(AppLocalizations.of(context)!.openMap)),
), ),
Align(
alignment: Alignment.bottomLeft,
child: PLZOrt(plzOrtC: plzOrtC),
),
Align( Align(
alignment: Alignment.bottomLeft, alignment: Alignment.bottomLeft,
child: BLand(bLandC: bLandC), child: BLand(bLandC: bLandC),
@@ -758,22 +580,54 @@ class _AddCamMainState extends State<AddCamMain> {
), ),
], ],
)), )),
// Date Step
Step( Step(
title: Text(AppLocalizations.of(context)!.kontakt), title: Text(AppLocalizations.of(context)!.date),
content: Column( content: Column(
children: [ children: [
Datum(
datum: datum,
),
KontDat(kontDat: kontDat),
const SizedBox( const SizedBox(
height: 15, height: 20,
),
Align(
alignment: Alignment.bottomLeft,
child: Row(
children: [
Text(AppLocalizations.of(context)!.ktage1),
const Text(
'*',
style: TextStyle(color: Colors.red),
),
],
),
),
KTage1(kTage1C: kTage1C),
const SizedBox(
height: 20,
), ),
Align( Align(
alignment: Alignment.bottomLeft, alignment: Alignment.bottomLeft,
child: NameVorname(nameVornameC: nameVornameC)), child: Row(
Align( children: [
alignment: Alignment.bottomLeft, Text(AppLocalizations.of(context)!.ktage2),
child: EmailTel(emailTelC: emailTelC), const Text(
), '*',
style: TextStyle(color: Colors.red),
)
],
)),
KTage2(kTage2C: kTage2C),
const SizedBox( const SizedBox(
height: 15, height: 20,
),
AbbauDat(abbauDat: abbauDat),
AusVon(ausVon: ausVon),
AusBis(ausBis: ausBis),
const SizedBox(
height: 20,
), ),
Align( Align(
alignment: Alignment.bottomLeft, alignment: Alignment.bottomLeft,
@@ -788,6 +642,29 @@ class _AddCamMainState extends State<AddCamMain> {
child: child:
SonstBemerkungen(sonstBemerkungenC: sonstBemerkungenC), SonstBemerkungen(sonstBemerkungenC: sonstBemerkungenC),
), ),
],
)),
Step(
title: Text(AppLocalizations.of(context)!.kontakt),
content: Column(
children: [
const SizedBox(
height: 15,
),
Align(
alignment: Alignment.bottomLeft,
child: Addresse1(addresse1C: addresse1C)),
Align(
alignment: Alignment.bottomLeft,
child: Addresse2(addresse2C: addresse2C),
),
Align(
alignment: Alignment.bottomLeft,
child: Addresse3(addresse3C: addresse3C),
),
const SizedBox(
height: 15,
),
Align( Align(
alignment: Alignment.bottomLeft, alignment: Alignment.bottomLeft,
child: FKontakt1(fKontakt1C: fKontakt1C), child: FKontakt1(fKontakt1C: fKontakt1C),
@@ -844,6 +721,8 @@ class _AddCamMainState extends State<AddCamMain> {
}); });
} else { } else {
String emptyField = validateData(); String emptyField = validateData();
// ! always fileed out
empty = false;
if (empty == true) { if (empty == true) {
showTemplateDialog(emptyField); showTemplateDialog(emptyField);
(); ();

View File

@@ -1,6 +1,7 @@
// ignore_for_file: non_constant_identifier_names // ignore_for_file: non_constant_identifier_names
import 'package:fforte/db_helper.dart'; import 'package:fforte/db_helper.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_map/flutter_map.dart'; import 'package:flutter_map/flutter_map.dart';
import 'package:geolocator/geolocator.dart'; import 'package:geolocator/geolocator.dart';
@@ -347,20 +348,23 @@ class _DatumState extends State<Datum> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Row( return Row(
children: [ children: [
Column(children: [ Row(children: [
SizedBox(
width: 125,
child: ElevatedButton(
onPressed: () async {
final date = await pickDate();
if (date == null) return;
setState(() => datum = date);
},
child: Text(AppLocalizations.of(context)!.pickDate)),
),
const SizedBox(
width: 10,
),
Text( Text(
'${datum?.day}. ${datum?.month}. ${datum?.year}', '${datum?.day}. ${datum?.month}. ${datum?.year}',
), ),
//const SizedBox(
// height: 2,
//),
ElevatedButton(
onPressed: () async {
final date = await pickDate();
if (date == null) return;
setState(() => datum = date);
},
child: Text(AppLocalizations.of(context)!.pickDate)),
]), ]),
], ],
); );
@@ -383,20 +387,20 @@ class _DatumState extends State<Datum> {
} }
} }
// NameVorname // Addresse1
class NameVorname extends StatefulWidget { class Addresse1 extends StatefulWidget {
final TextEditingController nameVornameC; final TextEditingController addresse1C;
const NameVorname({super.key, required this.nameVornameC}); const Addresse1({super.key, required this.addresse1C});
@override @override
State<NameVorname> createState() => _NameVornameState(); State<Addresse1> createState() => _Addresse1State();
} }
class _NameVornameState extends State<NameVorname> { class _Addresse1State extends State<Addresse1> {
String? selectedRudel; String? selectedRudel;
late Future<List<Map<String, dynamic>>> NameVorname; late Future<List<Map<String, dynamic>>> Addresse1;
@override @override
void initState() { void initState() {
@@ -404,15 +408,15 @@ class _NameVornameState extends State<NameVorname> {
_loadPref(); _loadPref();
NameVorname = DBHelper().getPlace(); Addresse1 = DBHelper().getPlace();
} }
void _loadPref() { void _loadPref() {
Future.delayed(Duration.zero, () async { Future.delayed(Duration.zero, () async {
SharedPreferences prefs = await SharedPreferences.getInstance(); SharedPreferences prefs = await SharedPreferences.getInstance();
String nameVorname = prefs.getString('nameVorname') ?? ""; String addresse1 = prefs.getString('addresse1') ?? "";
setState(() { setState(() {
widget.nameVornameC.text = nameVorname; widget.addresse1C.text = addresse1;
}); });
}); });
} }
@@ -425,21 +429,21 @@ class _NameVornameState extends State<NameVorname> {
flex: 2, flex: 2,
child: TextField( child: TextField(
decoration: InputDecoration( decoration: InputDecoration(
hintText: AppLocalizations.of(context)!.namevorname, hintText: AppLocalizations.of(context)!.adresse1,
enabledBorder: widget.nameVornameC.text.isEmpty enabledBorder: widget.addresse1C.text.isEmpty
? const UnderlineInputBorder( ? const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.red)) borderSide: BorderSide(color: Colors.red))
: const UnderlineInputBorder( : const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.green)), borderSide: BorderSide(color: Colors.green)),
focusedBorder: widget.nameVornameC.text.isEmpty focusedBorder: widget.addresse1C.text.isEmpty
? const UnderlineInputBorder( ? const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.red)) borderSide: BorderSide(color: Colors.red))
: const UnderlineInputBorder( : const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.green)), borderSide: BorderSide(color: Colors.green)),
), ),
controller: widget.nameVornameC, controller: widget.addresse1C,
onChanged: (value) => setState(() { onChanged: (value) => setState(() {
widget.nameVornameC.text = value; widget.addresse1C.text = value;
}), }),
)), )),
Expanded( Expanded(
@@ -447,20 +451,20 @@ class _NameVornameState extends State<NameVorname> {
child: Align( child: Align(
alignment: Alignment.bottomLeft, alignment: Alignment.bottomLeft,
child: FutureBuilder<List<Map<String, dynamic>>>( child: FutureBuilder<List<Map<String, dynamic>>>(
future: NameVorname, future: Addresse1,
builder: (BuildContext context, builder: (BuildContext context,
AsyncSnapshot<List<Map<String, dynamic>>> snapshot) { AsyncSnapshot<List<Map<String, dynamic>>> snapshot) {
if (snapshot.hasData) { if (snapshot.hasData) {
return DropdownButton<String>( return DropdownButton<String>(
items: snapshot.data! items: snapshot.data!
.map((item) => .map((item) =>
buildMenuItem(item['NameVorname'].toString())) buildMenuItem(item['Addresse1'].toString()))
.toList(), .toList(),
onChanged: (value) { onChanged: (value) {
setState( setState(
() { () {
selectedRudel = value; selectedRudel = value;
widget.nameVornameC.text = value ?? ''; widget.addresse1C.text = value ?? '';
}, },
); );
}, },
@@ -486,25 +490,25 @@ class _NameVornameState extends State<NameVorname> {
); );
} }
// PLZOrt // Addresse2
class PLZOrt extends StatefulWidget { class Addresse2 extends StatefulWidget {
final TextEditingController plzOrtC; final TextEditingController addresse2C;
const PLZOrt({super.key, required this.plzOrtC}); const Addresse2({super.key, required this.addresse2C});
@override @override
State<PLZOrt> createState() => _PLZOrtState(); State<Addresse2> createState() => _Addresse2State();
} }
class _PLZOrtState extends State<PLZOrt> { class _Addresse2State extends State<Addresse2> {
String? selectedRudel; String? selectedRudel;
late Future<List<Map<String, dynamic>>> PLZOrt; late Future<List<Map<String, dynamic>>> Addresse2;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
PLZOrt = DBHelper().getPlace(); Addresse2 = DBHelper().getPlace();
} }
@override @override
@@ -515,10 +519,10 @@ class _PLZOrtState extends State<PLZOrt> {
flex: 2, flex: 2,
child: TextField( child: TextField(
decoration: InputDecoration( decoration: InputDecoration(
hintText: AppLocalizations.of(context)!.plzort), hintText: AppLocalizations.of(context)!.adresse2),
controller: widget.plzOrtC, controller: widget.addresse2C,
onChanged: (value) => setState(() { onChanged: (value) => setState(() {
widget.plzOrtC.text = value; widget.addresse2C.text = value;
}), }),
)), )),
Expanded( Expanded(
@@ -526,19 +530,19 @@ class _PLZOrtState extends State<PLZOrt> {
child: Align( child: Align(
alignment: Alignment.bottomLeft, alignment: Alignment.bottomLeft,
child: FutureBuilder<List<Map<String, dynamic>>>( child: FutureBuilder<List<Map<String, dynamic>>>(
future: PLZOrt, future: Addresse2,
builder: (BuildContext context, builder: (BuildContext context,
AsyncSnapshot<List<Map<String, dynamic>>> snapshot) { AsyncSnapshot<List<Map<String, dynamic>>> snapshot) {
if (snapshot.hasData) { if (snapshot.hasData) {
return DropdownButton<String>( return DropdownButton<String>(
items: snapshot.data! items: snapshot.data!
.map((item) => buildMenuItem(item['PLZOrt'].toString())) .map((item) => buildMenuItem(item['Addresse2'].toString()))
.toList(), .toList(),
onChanged: (value) { onChanged: (value) {
setState( setState(
() { () {
selectedRudel = value; selectedRudel = value;
widget.plzOrtC.text = value ?? ''; widget.addresse2C.text = value ?? '';
}, },
); );
}, },
@@ -564,25 +568,25 @@ class _PLZOrtState extends State<PLZOrt> {
); );
} }
// EmailTel // Addresse3
class EmailTel extends StatefulWidget { class Addresse3 extends StatefulWidget {
final TextEditingController emailTelC; final TextEditingController addresse3C;
const EmailTel({super.key, required this.emailTelC}); const Addresse3({super.key, required this.addresse3C});
@override @override
State<EmailTel> createState() => _EmailTelState(); State<Addresse3> createState() => _Addresse3State();
} }
class _EmailTelState extends State<EmailTel> { class _Addresse3State extends State<Addresse3> {
String? selectedRudel; String? selectedRudel;
late Future<List<Map<String, dynamic>>> EmailTel; late Future<List<Map<String, dynamic>>> Addresse3;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
EmailTel = DBHelper().getPlace(); Addresse3 = DBHelper().getPlace();
} }
@override @override
@@ -593,28 +597,28 @@ class _EmailTelState extends State<EmailTel> {
flex: 2, flex: 2,
child: TextField( child: TextField(
decoration: InputDecoration( decoration: InputDecoration(
hintText: AppLocalizations.of(context)!.emailtel), hintText: AppLocalizations.of(context)!.adresse3),
controller: widget.emailTelC, controller: widget.addresse3C,
)), )),
Expanded( Expanded(
flex: 1, flex: 1,
child: Align( child: Align(
alignment: Alignment.bottomLeft, alignment: Alignment.bottomLeft,
child: FutureBuilder<List<Map<String, dynamic>>>( child: FutureBuilder<List<Map<String, dynamic>>>(
future: EmailTel, future: Addresse3,
builder: (BuildContext context, builder: (BuildContext context,
AsyncSnapshot<List<Map<String, dynamic>>> snapshot) { AsyncSnapshot<List<Map<String, dynamic>>> snapshot) {
if (snapshot.hasData) { if (snapshot.hasData) {
return DropdownButton<String>( return DropdownButton<String>(
items: snapshot.data! items: snapshot.data!
.map((item) => .map((item) =>
buildMenuItem(item['EmailTel'].toString())) buildMenuItem(item['Addresse3'].toString()))
.toList(), .toList(),
onChanged: (value) { onChanged: (value) {
setState( setState(
() { () {
selectedRudel = value; selectedRudel = value;
widget.emailTelC.text = value ?? ''; widget.addresse3C.text = value ?? '';
}, },
); );
}, },
@@ -659,7 +663,7 @@ class _BLandState extends State<BLand> {
void initState() { void initState() {
super.initState(); super.initState();
_loadPref(); if (widget.bLandC.text == "") _loadPref();
BLand = DBHelper().getPlace(); BLand = DBHelper().getPlace();
} }
@@ -949,7 +953,8 @@ class _OrtInfoState extends State<OrtInfo> {
flex: 2, flex: 2,
child: TextField( child: TextField(
decoration: InputDecoration( decoration: InputDecoration(
hintText: AppLocalizations.of(context)!.ortinfo,), hintText: AppLocalizations.of(context)!.ortinfo,
),
controller: widget.ortInfoC, controller: widget.ortInfoC,
onChanged: (value) => setState(() { onChanged: (value) => setState(() {
widget.ortInfoC.text = value; widget.ortInfoC.text = value;
@@ -1006,7 +1011,7 @@ class Status extends StatefulWidget {
final String initialStatus; final String initialStatus;
const Status( const Status(
{super.key, required this.onStatusChanged, this.initialStatus = 'aktiv'}); {super.key, required this.onStatusChanged, this.initialStatus = 'Aktiv'});
@override @override
State<Status> createState() => _StatusState(); State<Status> createState() => _StatusState();
@@ -1043,7 +1048,7 @@ class _StatusState extends State<Status> {
visualDensity: const VisualDensity(vertical: -4), visualDensity: const VisualDensity(vertical: -4),
title: Text(AppLocalizations.of(context)!.inaktiv), title: Text(AppLocalizations.of(context)!.inaktiv),
leading: Radio<String>( leading: Radio<String>(
value: 'inaktiv', value: 'anaktiv',
groupValue: _selectedStatus, groupValue: _selectedStatus,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
@@ -1240,7 +1245,7 @@ class _PlatzungState extends State<Platzung> {
visualDensity: const VisualDensity(vertical: -4), visualDensity: const VisualDensity(vertical: -4),
title: Text(AppLocalizations.of(context)!.kirrung), title: Text(AppLocalizations.of(context)!.kirrung),
leading: Radio<String>( leading: Radio<String>(
value: 'kirrung', value: 'Kirrung',
groupValue: _selectedPlatzung, groupValue: _selectedPlatzung,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
@@ -1254,7 +1259,7 @@ class _PlatzungState extends State<Platzung> {
visualDensity: const VisualDensity(vertical: -4), visualDensity: const VisualDensity(vertical: -4),
title: Text(AppLocalizations.of(context)!.wasserstelle), title: Text(AppLocalizations.of(context)!.wasserstelle),
leading: Radio<String>( leading: Radio<String>(
value: 'wasserstelle', value: 'Wasserstelle',
groupValue: _selectedPlatzung, groupValue: _selectedPlatzung,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
@@ -1268,7 +1273,7 @@ class _PlatzungState extends State<Platzung> {
visualDensity: const VisualDensity(vertical: -4), visualDensity: const VisualDensity(vertical: -4),
title: Text(AppLocalizations.of(context)!.wald), title: Text(AppLocalizations.of(context)!.wald),
leading: Radio<String>( leading: Radio<String>(
value: 'wald', value: 'Wald',
groupValue: _selectedPlatzung, groupValue: _selectedPlatzung,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
@@ -1282,7 +1287,7 @@ class _PlatzungState extends State<Platzung> {
visualDensity: const VisualDensity(vertical: -4), visualDensity: const VisualDensity(vertical: -4),
title: Text(AppLocalizations.of(context)!.wildwechsel), title: Text(AppLocalizations.of(context)!.wildwechsel),
leading: Radio<String>( leading: Radio<String>(
value: 'wildwechsel', value: 'Wildwechsel',
groupValue: _selectedPlatzung, groupValue: _selectedPlatzung,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
@@ -1296,7 +1301,7 @@ class _PlatzungState extends State<Platzung> {
visualDensity: const VisualDensity(vertical: -4), visualDensity: const VisualDensity(vertical: -4),
title: Text(AppLocalizations.of(context)!.wegstrasse), title: Text(AppLocalizations.of(context)!.wegstrasse),
leading: Radio<String>( leading: Radio<String>(
value: 'weg/straße', value: 'Weg/Straße',
groupValue: _selectedPlatzung, groupValue: _selectedPlatzung,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
@@ -1310,7 +1315,7 @@ class _PlatzungState extends State<Platzung> {
visualDensity: const VisualDensity(vertical: -4), visualDensity: const VisualDensity(vertical: -4),
title: Text(AppLocalizations.of(context)!.hofgarten), title: Text(AppLocalizations.of(context)!.hofgarten),
leading: Radio<String>( leading: Radio<String>(
value: 'hof/garten', value: 'Hof/Garten',
groupValue: _selectedPlatzung, groupValue: _selectedPlatzung,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
@@ -1324,7 +1329,7 @@ class _PlatzungState extends State<Platzung> {
visualDensity: const VisualDensity(vertical: -4), visualDensity: const VisualDensity(vertical: -4),
title: Text(AppLocalizations.of(context)!.wiesefeld), title: Text(AppLocalizations.of(context)!.wiesefeld),
leading: Radio<String>( leading: Radio<String>(
value: 'wiese/feld/offenfläche', value: 'Wiese/Feld/Offenfläche',
groupValue: _selectedPlatzung, groupValue: _selectedPlatzung,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
@@ -1371,7 +1376,7 @@ class _FotoFilmState extends State<FotoFilm> {
visualDensity: const VisualDensity(vertical: -4), visualDensity: const VisualDensity(vertical: -4),
title: Text(AppLocalizations.of(context)!.foto), title: Text(AppLocalizations.of(context)!.foto),
leading: Radio<String>( leading: Radio<String>(
value: 'foto', value: 'Foto',
groupValue: _selectedFotoFilm, groupValue: _selectedFotoFilm,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
@@ -1385,7 +1390,7 @@ class _FotoFilmState extends State<FotoFilm> {
visualDensity: const VisualDensity(vertical: -4), visualDensity: const VisualDensity(vertical: -4),
title: Text(AppLocalizations.of(context)!.film), title: Text(AppLocalizations.of(context)!.film),
leading: Radio<String>( leading: Radio<String>(
value: 'film', value: 'Film',
groupValue: _selectedFotoFilm, groupValue: _selectedFotoFilm,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
@@ -1406,7 +1411,8 @@ class MEZ extends StatefulWidget {
final Function(String) onMEZChanged; final Function(String) onMEZChanged;
final String initialMEZ; final String initialMEZ;
const MEZ({super.key, required this.onMEZChanged, this.initialMEZ = 'sommerzeit'}); const MEZ(
{super.key, required this.onMEZChanged, this.initialMEZ = 'sommerzeit'});
@override @override
State<MEZ> createState() => _MEZState(); State<MEZ> createState() => _MEZState();
@@ -1429,7 +1435,7 @@ class _MEZState extends State<MEZ> {
visualDensity: const VisualDensity(vertical: -4), visualDensity: const VisualDensity(vertical: -4),
title: Text(AppLocalizations.of(context)!.sommerzeit), title: Text(AppLocalizations.of(context)!.sommerzeit),
leading: Radio<String>( leading: Radio<String>(
value: 'sommerzeit', value: 'Sommerzeit',
groupValue: _selectedMEZ, groupValue: _selectedMEZ,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
@@ -1443,7 +1449,7 @@ class _MEZState extends State<MEZ> {
visualDensity: const VisualDensity(vertical: -4), visualDensity: const VisualDensity(vertical: -4),
title: Text(AppLocalizations.of(context)!.winterzeit), title: Text(AppLocalizations.of(context)!.winterzeit),
leading: Radio<String>( leading: Radio<String>(
value: 'winterzeit', value: 'Winterzeit',
groupValue: _selectedMEZ, groupValue: _selectedMEZ,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
@@ -1543,7 +1549,7 @@ class Bearsafe extends StatefulWidget {
const Bearsafe( const Bearsafe(
{super.key, {super.key,
required this.onBearsafeChanged, required this.onBearsafeChanged,
this.initialBearsafe = 'nein'}); this.initialBearsafe = 'Nein'});
@override @override
State<Bearsafe> createState() => _BearsafeState(); State<Bearsafe> createState() => _BearsafeState();
@@ -1566,7 +1572,7 @@ class _BearsafeState extends State<Bearsafe> {
visualDensity: const VisualDensity(vertical: -4), visualDensity: const VisualDensity(vertical: -4),
title: Text(AppLocalizations.of(context)!.nein), title: Text(AppLocalizations.of(context)!.nein),
leading: Radio<String>( leading: Radio<String>(
value: 'nein', value: 'Nein',
groupValue: _selectedBearsafe, groupValue: _selectedBearsafe,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
@@ -1580,7 +1586,7 @@ class _BearsafeState extends State<Bearsafe> {
visualDensity: const VisualDensity(vertical: -4), visualDensity: const VisualDensity(vertical: -4),
title: Text(AppLocalizations.of(context)!.ja), title: Text(AppLocalizations.of(context)!.ja),
leading: Radio<String>( leading: Radio<String>(
value: 'ja', value: 'Ja',
groupValue: _selectedBearsafe, groupValue: _selectedBearsafe,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
@@ -1613,20 +1619,23 @@ class _KontDatState extends State<KontDat> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Row( return Row(
children: [ children: [
Column(children: [ Row(children: [
SizedBox(
width: 125,
child: ElevatedButton(
onPressed: () async {
final date = await pickDate();
if (date == null) return;
setState(() => kontDat = date);
},
child: Text(AppLocalizations.of(context)!.pickkontdat)),
),
const SizedBox(
width: 10,
),
Text( Text(
'${kontDat?.day}. ${kontDat?.month}. ${kontDat?.year}', '${kontDat?.day}. ${kontDat?.month}. ${kontDat?.year}',
), ),
const SizedBox(
height: 8,
),
ElevatedButton(
onPressed: () async {
final date = await pickDate();
if (date == null) return;
setState(() => kontDat = date);
},
child: Text(AppLocalizations.of(context)!.pickkontdat)),
]), ]),
], ],
); );
@@ -1667,20 +1676,23 @@ class _AbbauDatState extends State<AbbauDat> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Row( return Row(
children: [ children: [
Column(children: [ Row(children: [
SizedBox(
width: 125,
child: ElevatedButton(
onPressed: () async {
final date = await pickDate();
if (date == null) return;
setState(() => abbauDat = date);
},
child: Text(AppLocalizations.of(context)!.pickabbaudat)),
),
const SizedBox(
width: 10,
),
Text( Text(
'${abbauDat?.day}. ${abbauDat?.month}. ${abbauDat?.year}', '${abbauDat?.day}. ${abbauDat?.month}. ${abbauDat?.year}',
), ),
const SizedBox(
height: 8,
),
ElevatedButton(
onPressed: () async {
final date = await pickDate();
if (date == null) return;
setState(() => abbauDat = date);
},
child: Text(AppLocalizations.of(context)!.pickabbaudat)),
]), ]),
], ],
); );
@@ -2188,7 +2200,18 @@ class _AltStOrtState extends State<AltStOrt> {
flex: 3, flex: 3,
child: TextField( child: TextField(
decoration: InputDecoration( decoration: InputDecoration(
hintText: AppLocalizations.of(context)!.altstort), hintText: AppLocalizations.of(context)!.altstort,
enabledBorder: widget.altStOrtC.text.isEmpty
? const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.red))
: const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.green)),
focusedBorder: widget.altStOrtC.text.isEmpty
? const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.red))
: const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.green)),
),
controller: widget.altStOrtC, controller: widget.altStOrtC,
)), )),
Expanded( Expanded(
@@ -2253,7 +2276,20 @@ class _AusVonState extends State<AusVon> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Row( return Row(
children: [ children: [
Column(children: [ Row(children: [
SizedBox(
width: 125,
child: ElevatedButton(
onPressed: () async {
final date = await pickDate();
if (date == null) return;
setState(() => ausVon = date);
},
child: Text(AppLocalizations.of(context)!.ausvon)),
),
const SizedBox(
width: 10,
),
Builder(builder: (context) { Builder(builder: (context) {
if (ausVon != null) { if (ausVon != null) {
return Text('${ausVon?.day}. ${ausVon?.month}. ${ausVon?.year}'); return Text('${ausVon?.day}. ${ausVon?.month}. ${ausVon?.year}');
@@ -2261,16 +2297,6 @@ class _AusVonState extends State<AusVon> {
return Text(AppLocalizations.of(context)!.nichts); return Text(AppLocalizations.of(context)!.nichts);
} }
}), }),
const SizedBox(
height: 8,
),
ElevatedButton(
onPressed: () async {
final date = await pickDate();
if (date == null) return;
setState(() => ausVon = date);
},
child: Text(AppLocalizations.of(context)!.ausvon)),
]), ]),
], ],
); );
@@ -2311,7 +2337,20 @@ class _AusBisState extends State<AusBis> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Row( return Row(
children: [ children: [
Column(children: [ Row(children: [
SizedBox(
width: 125,
child: ElevatedButton(
onPressed: () async {
final date = await pickDate();
if (date == null) return;
setState(() => ausBis = date);
},
child: Text(AppLocalizations.of(context)!.ausbis)),
),
const SizedBox(
width: 10,
),
Builder(builder: (context) { Builder(builder: (context) {
if (ausBis != null) { if (ausBis != null) {
return Text('${ausBis?.day}. ${ausBis?.month}. ${ausBis?.year}'); return Text('${ausBis?.day}. ${ausBis?.month}. ${ausBis?.year}');
@@ -2319,16 +2358,6 @@ class _AusBisState extends State<AusBis> {
return Text(AppLocalizations.of(context)!.nichts); return Text(AppLocalizations.of(context)!.nichts);
} }
}), }),
const SizedBox(
height: 8,
),
ElevatedButton(
onPressed: () async {
final date = await pickDate();
if (date == null) return;
setState(() => ausBis = date);
},
child: Text(AppLocalizations.of(context)!.ausbis)),
]), ]),
], ],
); );
@@ -2515,16 +2544,16 @@ class _IntKommState extends State<IntKomm> {
// KontSum // KontSum
class KontSum extends StatefulWidget { class Betreuung extends StatefulWidget {
final TextEditingController kontSumC; final TextEditingController betreuungC;
const KontSum({super.key, required this.kontSumC}); const Betreuung({super.key, required this.betreuungC});
@override @override
State<KontSum> createState() => _KontSumState(); State<Betreuung> createState() => _BetreuungState();
} }
class _KontSumState extends State<KontSum> { class _BetreuungState extends State<Betreuung> {
String? selectedRudel; String? selectedRudel;
late Future<List<Map<String, dynamic>>> KontSum; late Future<List<Map<String, dynamic>>> KontSum;
@@ -2542,8 +2571,8 @@ class _KontSumState extends State<KontSum> {
flex: 3, flex: 3,
child: TextField( child: TextField(
decoration: InputDecoration( decoration: InputDecoration(
hintText: AppLocalizations.of(context)!.kontsum), hintText: AppLocalizations.of(context)!.betreuung),
controller: widget.kontSumC, controller: widget.betreuungC,
)), )),
Expanded( Expanded(
flex: 1, flex: 1,
@@ -2563,7 +2592,7 @@ class _KontSumState extends State<KontSum> {
setState( setState(
() { () {
selectedRudel = value; selectedRudel = value;
widget.kontSumC.text = value ?? ''; widget.betreuungC.text = value ?? '';
}, },
); );
}, },

View File

@@ -31,9 +31,9 @@ class DBHelper {
// The function that helps // The function that helps
_onCreatePlace(Database placeDB, int version) async { _onCreatePlace(Database placeDB, int version) async {
await placeDB.execute( await placeDB.execute(
'CREATE TABLE place (id INTEGER PRIMARY KEY, CID TEXT UNIQUE, Standort TEXT, Rudel TEXT, Datum DATE, NameVorname TEXT, PLZOrt TEXT, EmailTel TEXT, BLand TEXT, Lkr TEXT, BeiOrt TEXT, OrtInfo TEXT, Status TEXT, STTyp TEXT, FFTyp TEXT, FotoFilm TEXT, MEZ TEXT, Platzung TEXT, KSchloNr TEXT, Bearsafe TEXT, KontDat DATE, KontSum TEXT, AbbauDat DATE, Auftrag TEXT, Absprachen TEXT, SonstBemerkungen TEXT, FKontakt1 TEXT, FKontakt2 TEXT, FKontakt3 TEXT, AltStOrt, AusVon DATE, AusBis DATE, KTage1 INTEGER, KTage2 INTEGER, ProtoAm DATE, IntKomm TEXT, Sent INTEGER DEFAULT 0)'); 'CREATE TABLE place (id INTEGER PRIMARY KEY, CID TEXT UNIQUE, Standort TEXT, Rudel TEXT, Datum DATE, Adresse1 TEXT, Adresse2 TEXT, Adresse3 TEXT, BLand TEXT, Lkr TEXT, BeiOrt TEXT, OrtInfo TEXT, Status TEXT, STTyp TEXT, FFTyp TEXT, FotoFilm TEXT, MEZ TEXT, Platzung TEXT, KSchloNr TEXT, Bearsafe TEXT, KontDat DATE, Betreuung TEXT, AbbauDat DATE, Auftrag TEXT, KontAbsp TEXT, SonstBem TEXT, FKontakt1 TEXT, FKontakt2 TEXT, FKontakt3 TEXT, AusVon DATE, AusBis DATE, KTage1 INTEGER, KTage2 INTEGER, ProtoAm DATE, IntKomm TEXT, DECLNG DECIMALS(4,8), DECLAT DECIMALS(4,8), Sent INTEGER DEFAULT 0)');
await placeDB.execute( await placeDB.execute(
'CREATE TABLE templates (id INTEGER PRIMARY KEY, CID TEXT UNIQUE, Standort TEXT, Rudel TEXT, Datum DATE, NameVorname TEXT, PLZOrt TEXT, EmailTel TEXT, BLand TEXT, Lkr TEXT, BeiOrt TEXT, OrtInfo TEXT, Status TEXT, STTyp TEXT, FFTyp TEXT, FotoFilm TEXT, MEZ TEXT, Platzung TEXT, KSchloNr TEXT, Bearsafe TEXT, KontDat DATE, KontSum TEXT, AbbauDat DATE, Auftrag TEXT, Absprachen TEXT, SonstBemerkungen TEXT, FKontakt1 TEXT, FKontakt2 TEXT, FKontakt3 TEXT, AltStOrt TEXT, AusVon DATE, AusBis DATE, KTage1 INTEGER, KTage2 INTEGER, ProtoAm DATE, IntKomm TEXT)'); 'CREATE TABLE templates (id INTEGER PRIMARY KEY, CID TEXT UNIQUE, Standort TEXT, Rudel TEXT, Datum DATE, Adresse1 TEXT, Adresse2 TEXT, Adresse3 TEXT, BLand TEXT, Lkr TEXT, BeiOrt TEXT, OrtInfo TEXT, Status TEXT, STTyp TEXT, FFTyp TEXT, FotoFilm TEXT, MEZ TEXT, Platzung TEXT, KSchloNr TEXT, Bearsafe TEXT, KontDat DATE, Betreuung TEXT, AbbauDat DATE, Auftrag TEXT, KontAbsp TEXT, SonstBem TEXT, FKontakt1 TEXT, FKontakt2 TEXT, FKontakt3 TEXT, AusVon DATE, AusBis DATE, KTage1 INTEGER, KTage2 INTEGER, ProtoAm DATE, IntKomm TEXT, DECLNG DECIMALS(4,8), DECLAT DECIMALS(4,8))');
} }

View File

@@ -1,5 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart';
@@ -11,14 +10,33 @@ class IntroScreen extends StatefulWidget {
} }
class _IntroScreenState extends State<IntroScreen> { class _IntroScreenState extends State<IntroScreen> {
TextEditingController nameVornameC = TextEditingController(); TextEditingController addresse1C = TextEditingController();
TextEditingController bLandC = TextEditingController(); TextEditingController bLandC = TextEditingController();
TextEditingController apiAddress = TextEditingController();
Future<void> _saveData() async { Future<void> _saveData() async {
SharedPreferences prefs = await SharedPreferences.getInstance(); SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setString('nameVorname', nameVornameC.text); await prefs.setString('addresse1', addresse1C.text);
await prefs.setString('bLand', bLandC.text); await prefs.setString('bLand', bLandC.text);
await prefs.setBool('isFirstLaunch', false); await prefs.setBool('isFirstLaunch', false);
await prefs.setString('apiAddress', apiAddress.text);
}
@override
void initState() {
super.initState();
_loadPrefs();
}
void _loadPrefs() {
Future.delayed(Duration.zero, () async {
SharedPreferences prefs = await SharedPreferences.getInstance();
setState(() {
apiAddress.text = prefs.getString('apiAddress') ?? "";
addresse1C.text = prefs.getString('addresse1') ?? "";
bLandC.text = prefs.getString('bLand') ?? "";
});
});
} }
@override @override
@@ -34,10 +52,10 @@ class _IntroScreenState extends State<IntroScreen> {
children: [ children: [
TextField( TextField(
decoration: InputDecoration( decoration: InputDecoration(
hintText: AppLocalizations.of(context)!.namevorname), hintText: AppLocalizations.of(context)!.benutzername),
controller: nameVornameC, controller: addresse1C,
onChanged: (value) => setState(() { onChanged: (value) => setState(() {
nameVornameC.text = value; addresse1C.text = value;
}), }),
), ),
const SizedBox( const SizedBox(
@@ -45,8 +63,8 @@ class _IntroScreenState extends State<IntroScreen> {
), ),
Column( Column(
children: [ children: [
DropdownButton( DropdownButton(
hint: Text(bLandC.text), hint: Text(bLandC.text),
items: const [ items: const [
DropdownMenuItem( DropdownMenuItem(
value: 'Baden-Württemberg', value: 'Baden-Württemberg',
@@ -118,10 +136,18 @@ class _IntroScreenState extends State<IntroScreen> {
bLandC.text = value!; bLandC.text = value!;
}); });
}, },
), ),
TextField( TextField(
controller: bLandC, controller: bLandC,
), ),
const SizedBox(
height: 15,
),
TextField(
decoration: InputDecoration(
hintText: AppLocalizations.of(context)!.apiaddress),
controller: apiAddress,
)
], ],
), ),
const SizedBox( const SizedBox(

View File

@@ -1,22 +1,21 @@
{ {
"homePageTitle": "FFOrte", "homePageTitle": "Wildtiermonitoring",
"addplace": "Standort hinzufügen", "addplace": "Standort hinzufügen",
"completed": "Vollständig", "completed": "Vollständig",
"uncompleted": "Unvollständig", "uncompleted": "Unvollständig",
"deleteEverything": "Alles löschen?", "deleteEverything": "Alles löschen?",
"deleteEverythingContent": "Alle Standorte werden lokal gelöscht!", "deleteEverythingContent": "Alle Standorte werden lokal gelöscht!",
"camLink": "ID der Kamera", "camLink": "ID der Kamera",
"firstStep": "STANDORT, KAMERA, TERRITORIUM",
"secondStep": "DATUM, KONTAKT, ORT", "secondStep": "DATUM, KONTAKT, ORT",
"date": "DATUM", "date": "DATUM, AUFBAU, KONTROLLE",
"kontakt": "KONTAKT", "kontakt": "KONTAKT, ANSPRECHPARTNER",
"status": "Status", "status": "Status",
"viewplacesappbar": "Standorte ansehen", "viewplacesappbar": "Standorte ansehen",
"locations": "STANDORT", "locations": "ORT, UMGEBUNG",
"rudel": "Territorium", "rudel": "Territorium",
"namevorname": "Name", "adresse1": "Adresse 1",
"plzort": "PLZ und Ort", "adresse2": "Adresse 2",
"emailtel": "Email und/oder Telefon", "adresse3": "Adresse 3",
"bland": "Bundesland", "bland": "Bundesland",
"lkr": "Landkreis", "lkr": "Landkreis",
"beiort": "Bei Ort", "beiort": "Bei Ort",
@@ -39,26 +38,26 @@
"kschlonr": "KSchloss Nummer", "kschlonr": "KSchloss Nummer",
"nein": "Nein", "nein": "Nein",
"ja": "Ja", "ja": "Ja",
"pickkontdat": "Datum Kontrolle", "pickkontdat": "Kontrolle",
"pickabbaudat": "Datum Abbau", "pickabbaudat": "Abbau",
"platzung": "Platzierung", "platzung": "Platzierung",
"zeiteinstellung": "Zeiteinstellung", "zeiteinstellung": "Zeiteinstellung",
"auftrag": "Auftrag", "auftrag": "Auftrag",
"absprachen": "Absprachen", "absprachen": "Absprachen",
"sonstbemerkungen": "Sonstige Bemerkungen", "sonstbemerkungen": "Sonstige Bemerkungen",
"fkontakt1": "FKontakt 1", "fkontakt1": "Kontakt für Fläche",
"fkontakt2": "FKontakt 2", "fkontakt2": "Kontakt Eigentümer",
"fkontakt3": "FKontakt 3", "fkontakt3": "Kontakt Revier/Jagd",
"hofgarten": "Hof/Garten", "hofgarten": "Hof/Garten",
"altstort": "Standort", "altstort": "Standort",
"wiesefeld": "Wiese/Feld/offenfläche", "wiesefeld": "Wiese/Feld/Offenfläche",
"ausvon": "Aus von", "ausvon": "Ausfall von",
"nichts": "---", "nichts": "---",
"ausbis": "Aus Bis", "ausbis": "Ausfall bis",
"ktage1": "KTage 1", "ktage1": "Kontrollintervall (Tage 1)",
"ktage2": "KTage 2", "ktage2": "Kontrollintervall (Tage 2)",
"eugrid": "EUGrid", "eugrid": "EUGrid",
"pickDate": "Datum Aufstellung", "pickDate": "Aufstellung",
"pickTime": "Zeit auswählen", "pickTime": "Zeit auswählen",
"delAll": "Alle Standorte löschen", "delAll": "Alle Standorte löschen",
"fieldEmpty": "Folgendes Feld ist leer:", "fieldEmpty": "Folgendes Feld ist leer:",
@@ -70,7 +69,7 @@
"locationForbidden": "Zugriff auf Standort verweigert. Es ist empfohlen dies zu erlauben", "locationForbidden": "Zugriff auf Standort verweigert. Es ist empfohlen dies zu erlauben",
"map": "Karte", "map": "Karte",
"markerSet": "Marker gesetzt auf", "markerSet": "Marker gesetzt auf",
"kontsum": "Kontrollsumme", "betreuung": "Betreuung",
"bearsafe": "Bearsafe", "bearsafe": "Bearsafe",
"sttyp": "Wahl des Standortes", "sttyp": "Wahl des Standortes",
"ort": "Ort", "ort": "Ort",
@@ -81,5 +80,7 @@
"sendtoserver": "Zum Server senden", "sendtoserver": "Zum Server senden",
"savemethod": "Speichermethode auswählen", "savemethod": "Speichermethode auswählen",
"viewplaces": "Standorte anzeigen", "viewplaces": "Standorte anzeigen",
"showloginscreen": "Login-Bildschirm Anzeigen" "showloginscreen": "Login-Bildschirm Anzeigen",
"apiaddress": "Api-Adresse",
"benutzername": "Benutzername"
} }

View File

@@ -1,5 +1,5 @@
{ {
"homePageTitle": "FFOrte", "homePageTitle": "wildlife monitoring",
"@homePageTitle": { "@homePageTitle": {
"description": "The title of the homepage" "description": "The title of the homepage"
}, },
@@ -32,7 +32,7 @@
"description": "title first step" "description": "title first step"
}, },
"date": "Date", "date": "Installation and control date ",
"@date": { "@date": {
"description": "date step" "description": "date step"
}, },
@@ -55,7 +55,7 @@
"@viewplacesappbar": { "@viewplacesappbar": {
"description": "view places appbar" "description": "view places appbar"
}, },
"locations": "Location", "locations": "Place, neighbouhood",
"@locations": { "@locations": {
"description": "Location textfield" "description": "Location textfield"
}, },
@@ -63,18 +63,18 @@
"@rudel": { "@rudel": {
"description": "Rudel textfield" "description": "Rudel textfield"
}, },
"namevorname": "Name", "adresse1": "Address 1",
"@namevorname": { "@adresse1": {
"description": "Name Vorname textfield" "description": "Address 1 textfield"
}, },
"plzort": "Postal code and town", "adresse2": "Address 2",
"@plzort": { "@adresse2": {
"description": "PLZ Ort textfield" "description": "Address 2 textfield"
}, },
"emailtel": "Email and/or Phone", "adresse3": "Address 3",
"@emailtel": { "@adresse3": {
"description": "email or phone textfield" "description": "adress3 textfield"
}, },
"bland": "State", "bland": "State",
@@ -182,12 +182,12 @@
"description": "yes radiobutton" "description": "yes radiobutton"
}, },
"pickkontdat": "Pick KontDat", "pickkontdat": "Control",
"@pickkontdat": { "@pickkontdat": {
"description": "pickkontdat button" "description": "pickkontdat button"
}, },
"pickabbaudat": "Pick Disamble Date", "pickabbaudat": "Disamble",
"@abbaudat": { "@abbaudat": {
"description": "pickabbaudat button" "description": "pickabbaudat button"
}, },
@@ -272,9 +272,9 @@
"description": "intkomm textfield" "description": "intkomm textfield"
}, },
"kontsum": "Control sum", "betreuung": "Care",
"@kontsum": { "@betreuung": {
"description": "kontsum textfield" "description": "Betreuung textfield"
}, },
"hofgarten": "Yard/Garden", "hofgarten": "Yard/Garden",
@@ -291,7 +291,7 @@
"@eugrid": { "@eugrid": {
"description": "EUGrid textfield" "description": "EUGrid textfield"
}, },
"pickDate": "Pick Date", "pickDate": "Installation",
"@pickDate": { "@pickDate": {
"description": "Pick date button" "description": "Pick date button"
}, },
@@ -388,6 +388,16 @@
"showloginscreen": "Show login Screen", "showloginscreen": "Show login Screen",
"@showloginscreen": { "@showloginscreen": {
"description": "show login screen popup menu item" "description": "show login screen popup menu item"
},
"apiaddress": "Api-address",
"@apiaddress": {
"description": "api address hint"
},
"benutzername": "Username",
"@benutzername": {
"description": "intro screen benutzername hint"
} }
} }

View File

@@ -1,6 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:shared_preferences/shared_preferences.dart';
class Settings extends StatefulWidget { class Settings extends StatefulWidget {
const Settings({super.key}); const Settings({super.key});
@@ -10,98 +8,8 @@ class Settings extends StatefulWidget {
} }
class _SettingsState extends State<Settings> { class _SettingsState extends State<Settings> {
late Future<String> initName;
late Future<String> initBLand;
TextEditingController nameVornameC = TextEditingController();
TextEditingController bLandC = TextEditingController();
@override
void initState() {
super.initState();
initName = _loadName();
initBLand = _loadBLand();
}
Future<String> _loadName() {
Future<String> initName = Future.delayed(Duration.zero, () async {
final SharedPreferences prefs = await SharedPreferences.getInstance();
final String initName = prefs.getString('nameVorname') ?? '';
nameVornameC.text = initName;
return initName;
});
return initName;
}
Future<String> _loadBLand() {
Future<String> initBLand = Future.delayed(Duration.zero, () async {
final SharedPreferences prefs = await SharedPreferences.getInstance();
final String initBLand = prefs.getString('bLand') ?? '';
bLandC.text = initBLand;
return initBLand;
});
return initBLand;
}
void _saveName() async {
final SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setString('nameVorname', nameVornameC.text);
}
void _saveBLand() async {
final SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setString('bLand', bLandC.text);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return const Placeholder();
appBar: AppBar(title: Text(AppLocalizations.of(context)!.settings)),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
Text(AppLocalizations.of(context)!.changenamestate ,style: const TextStyle(fontSize: 20, ),),
FutureBuilder<String>(
future: initName, // your Future<String>
builder:
(BuildContext context, AsyncSnapshot<String> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
return TextField(
controller: nameVornameC,
decoration: InputDecoration(
labelText: AppLocalizations.of(context)!.namevorname,
),
);
} else {
// Optionally, return a placeholder widget while waiting
return const CircularProgressIndicator();
}
},
),
FutureBuilder<String>(
future: initBLand,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
return TextField(
controller: bLandC,
decoration: InputDecoration(labelText: AppLocalizations.of(context)!.bland),
);
} else {
return const CircularProgressIndicator();
}
},
)
],
),
),
),
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.save),
onPressed: () {
_saveName();
_saveBLand();
}),
);
} }
} }

View File

@@ -201,11 +201,11 @@ class _ViewCamsState extends State<ViewCams> {
Text( Text(
'${AppLocalizations.of(context)!.sommerzeit}: ${place['MEZ']}'), '${AppLocalizations.of(context)!.sommerzeit}: ${place['MEZ']}'),
Text( Text(
'${AppLocalizations.of(context)!.kontsum}: ${place['KontSum']}'), '${AppLocalizations.of(context)!.betreuung}: ${place['Betreuung']}'),
Text( Text(
'${AppLocalizations.of(context)!.locations}: ${place['Standort']}'), '${AppLocalizations.of(context)!.locations}: ${place['Standort']}'),
Text( Text(
'${AppLocalizations.of(context)!.plzort}: ${place['PLZOrt']}'), '${AppLocalizations.of(context)!.adresse3}: ${place['PLZOrt']}'),
Text( Text(
'${AppLocalizations.of(context)!.bland}: ${place['BLand']}'), '${AppLocalizations.of(context)!.bland}: ${place['BLand']}'),
Text( Text(
@@ -217,9 +217,9 @@ class _ViewCamsState extends State<ViewCams> {
Text( Text(
'${AppLocalizations.of(context)!.altstort}: ${place['AltStOrt']}'), '${AppLocalizations.of(context)!.altstort}: ${place['AltStOrt']}'),
Text( Text(
'${AppLocalizations.of(context)!.namevorname}: ${place['NameVorname']}'), '${AppLocalizations.of(context)!.adresse1}: ${place['NameVorname']}'),
Text( Text(
'${AppLocalizations.of(context)!.emailtel}: ${place['EmailTel']}'), '${AppLocalizations.of(context)!.adresse2}: ${place['EmailTel']}'),
Text( Text(
'${AppLocalizations.of(context)!.auftrag}: ${place['Auftrag']}'), '${AppLocalizations.of(context)!.auftrag}: ${place['Auftrag']}'),
Text( Text(

View File

@@ -43,3 +43,4 @@
16 mär 4h 16 mär 4h
20 mär 6h 15 min 20 mär 6h 15 min
21 mär 4h 15 min

View File

@@ -1 +1,5 @@
{} {
"de": [
"firstStep"
]
}