now doesnt leave the addcam when user canceles save as file option
This commit is contained in:
7
Todo.txt
7
Todo.txt
@@ -2,11 +2,7 @@ todo:
|
||||
maybe auch vorschläge aus templates in dropdown menüs anzeigen
|
||||
im englischen abändern
|
||||
zurückfeld in datenansicht
|
||||
dropdown menü fixen (ai fragen)
|
||||
fehler beim speichern anzeigen
|
||||
nach koordinaten lkr auswählen (esri-leaflet-geocoder)
|
||||
fix ktage und nebeneinander positioniere
|
||||
textdateien auch an server senden
|
||||
error check wenn dateiauswahl abgebrochen wurde einfügen
|
||||
save option einfügen nur zum speichern
|
||||
ausvon und ausbis fixen (falsches datum übergeben (20000-01-01))
|
||||
@@ -27,6 +23,9 @@ eintrg in db wenn http response (in sent column)
|
||||
|
||||
|
||||
not to do:
|
||||
fix ktage und nebeneinander positioniere
|
||||
nach koordinaten lkr auswählen (esri-leaflet-geocoder)
|
||||
dropdown menü fixen (ai fragen)
|
||||
überschriften für view cams
|
||||
standartwert in textfeld
|
||||
überschriften für view cams
|
||||
|
||||
@@ -270,11 +270,6 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
saveData();
|
||||
saveFile();
|
||||
// ignore: use_build_context_synchronously
|
||||
Navigator.pushNamedAndRemoveUntil(
|
||||
// ignore: use_build_context_synchronously
|
||||
context,
|
||||
'/home',
|
||||
(route) => false);
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.saveasfile)),
|
||||
TextButton(
|
||||
@@ -325,14 +320,13 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
|
||||
Future<void> saveFile() async {
|
||||
String? selectedDirectory = await FilePicker.platform.getDirectoryPath();
|
||||
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
|
||||
Map place = getPlace();
|
||||
|
||||
String jsonPlace = jsonEncode(place);
|
||||
|
||||
if (selectedDirectory == null) {
|
||||
// ignore: use_build_context_synchronously
|
||||
Navigator.pop(context);
|
||||
return;
|
||||
}
|
||||
await prefs.setString('saveDir', selectedDirectory);
|
||||
@@ -344,6 +338,12 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
// ignore: use_build_context_synchronously
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Datei gespeichert in $selectedDirectory')));
|
||||
|
||||
Navigator.pushNamedAndRemoveUntil(
|
||||
// ignore: use_build_context_synchronously
|
||||
context,
|
||||
'/home',
|
||||
(route) => false);
|
||||
}
|
||||
|
||||
// checks if required fields are not empty. If one is the name will be returned
|
||||
@@ -518,11 +518,19 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
VarTextField(textController: kSchloNrC, localization: AppLocalizations.of(context)!.kschlonr, dbName: "KSchloNr", required: false),
|
||||
VarTextField(
|
||||
textController: kSchloNrC,
|
||||
localization: AppLocalizations.of(context)!.kschlonr,
|
||||
dbName: "KSchloNr",
|
||||
required: false),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
VarTextField(textController: rudelC, localization: AppLocalizations.of(context)!.rudel, dbName: "Rudel", required: true),
|
||||
VarTextField(
|
||||
textController: rudelC,
|
||||
localization: AppLocalizations.of(context)!.rudel,
|
||||
dbName: "Rudel",
|
||||
required: true),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
@@ -548,6 +556,7 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
.push<LatLng>(
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return Karte(
|
||||
beiOrtC: beiOrtC,
|
||||
currentPosition: currentPosition,
|
||||
onPositionChange: (updatedPosition) {
|
||||
setState(() {
|
||||
@@ -575,10 +584,28 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.openMap)),
|
||||
),
|
||||
VarTextField(textController: bLandC, localization: AppLocalizations.of(context)!.bland, dbName: "BLand", required: true, default_value: "bLand",),
|
||||
VarTextField(textController: lkrC, localization: AppLocalizations.of(context)!.lkr, dbName: "Lkr", required: true),
|
||||
VarTextField(textController: beiOrtC, localization: AppLocalizations.of(context)!.beiort, dbName: "BeiOrt", required: true),
|
||||
VarTextField(textController: ortInfoC, localization: AppLocalizations.of(context)!.ortinfo, dbName: "OrtInfo", required: false),
|
||||
VarTextField(
|
||||
textController: bLandC,
|
||||
localization: AppLocalizations.of(context)!.bland,
|
||||
dbName: "BLand",
|
||||
required: true,
|
||||
default_value: "bLand",
|
||||
),
|
||||
VarTextField(
|
||||
textController: lkrC,
|
||||
localization: AppLocalizations.of(context)!.lkr,
|
||||
dbName: "Lkr",
|
||||
required: true),
|
||||
VarTextField(
|
||||
textController: beiOrtC,
|
||||
localization: AppLocalizations.of(context)!.beiort,
|
||||
dbName: "BeiOrt",
|
||||
required: true),
|
||||
VarTextField(
|
||||
textController: ortInfoC,
|
||||
localization: AppLocalizations.of(context)!.ortinfo,
|
||||
dbName: "OrtInfo",
|
||||
required: false),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
@@ -627,7 +654,13 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
],
|
||||
),
|
||||
),
|
||||
VarTextField(textController: kTage1C, localization: AppLocalizations.of(context)!.ktage1, dbName: "KTage1", required: true, default_value: "kTage1",),
|
||||
VarTextField(
|
||||
textController: kTage1C,
|
||||
localization: AppLocalizations.of(context)!.ktage1,
|
||||
dbName: "KTage1",
|
||||
required: true,
|
||||
default_value: "kTage1",
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
@@ -642,7 +675,13 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
)
|
||||
],
|
||||
)),
|
||||
VarTextField(textController: kTage2C, localization: AppLocalizations.of(context)!.ktage2, dbName: "KTage1", required: true, default_value: "kTage2",),
|
||||
VarTextField(
|
||||
textController: kTage2C,
|
||||
localization: AppLocalizations.of(context)!.ktage2,
|
||||
dbName: "KTage1",
|
||||
required: true,
|
||||
default_value: "kTage2",
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
@@ -661,9 +700,22 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
VarTextField(textController: auftragC, localization: AppLocalizations.of(context)!.auftrag, dbName: "Auftrag", required: false),
|
||||
VarTextField(textController: kontAbspC, localization: AppLocalizations.of(context)!.kontabsp, dbName: "KontAbsp", required: false),
|
||||
VarTextField(textController: sonstBemC, localization: AppLocalizations.of(context)!.sonstbemerkungen, dbName: "SonstBem", required: false),
|
||||
VarTextField(
|
||||
textController: auftragC,
|
||||
localization: AppLocalizations.of(context)!.auftrag,
|
||||
dbName: "Auftrag",
|
||||
required: false),
|
||||
VarTextField(
|
||||
textController: kontAbspC,
|
||||
localization: AppLocalizations.of(context)!.kontabsp,
|
||||
dbName: "KontAbsp",
|
||||
required: false),
|
||||
VarTextField(
|
||||
textController: sonstBemC,
|
||||
localization:
|
||||
AppLocalizations.of(context)!.sonstbemerkungen,
|
||||
dbName: "SonstBem",
|
||||
required: false),
|
||||
],
|
||||
)),
|
||||
// Fourth step
|
||||
@@ -671,16 +723,46 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
title: Text(AppLocalizations.of(context)!.fourthstep),
|
||||
content: Column(
|
||||
children: [
|
||||
VarTextField(textController: adresse1C, localization: AppLocalizations.of(context)!.adresse1, dbName: "Adresse1", required: true, default_value: "addresse1",),
|
||||
VarTextField(textController: adresse2C, localization: AppLocalizations.of(context)!.adresse2, dbName: "Adresse2", required: false),
|
||||
VarTextField(textController: adresse3C, localization: AppLocalizations.of(context)!.adresse3, dbName: "Adresse2", required: false),
|
||||
VarTextField(
|
||||
textController: adresse1C,
|
||||
localization: AppLocalizations.of(context)!.adresse1,
|
||||
dbName: "Adresse1",
|
||||
required: true,
|
||||
default_value: "addresse1",
|
||||
),
|
||||
VarTextField(
|
||||
textController: adresse2C,
|
||||
localization: AppLocalizations.of(context)!.adresse2,
|
||||
dbName: "Adresse2",
|
||||
required: false),
|
||||
VarTextField(
|
||||
textController: adresse3C,
|
||||
localization: AppLocalizations.of(context)!.adresse3,
|
||||
dbName: "Adresse2",
|
||||
required: false),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
VarTextField(textController: fKontakt1C, localization: AppLocalizations.of(context)!.fkontakt1, dbName: "FKontakt1", required: false),
|
||||
VarTextField(textController: fKontakt2C, localization: AppLocalizations.of(context)!.fkontakt2, dbName: "FKontakt2", required: false),
|
||||
VarTextField(textController: fKontakt3C, localization: AppLocalizations.of(context)!.fkontakt3, dbName: "FKontakt3", required: false),
|
||||
VarTextField(textController: intKommC, localization: AppLocalizations.of(context)!.intkomm, dbName: "IntKomm", required: false),
|
||||
VarTextField(
|
||||
textController: fKontakt1C,
|
||||
localization: AppLocalizations.of(context)!.fkontakt1,
|
||||
dbName: "FKontakt1",
|
||||
required: false),
|
||||
VarTextField(
|
||||
textController: fKontakt2C,
|
||||
localization: AppLocalizations.of(context)!.fkontakt2,
|
||||
dbName: "FKontakt2",
|
||||
required: false),
|
||||
VarTextField(
|
||||
textController: fKontakt3C,
|
||||
localization: AppLocalizations.of(context)!.fkontakt3,
|
||||
dbName: "FKontakt3",
|
||||
required: false),
|
||||
VarTextField(
|
||||
textController: intKommC,
|
||||
localization: AppLocalizations.of(context)!.intkomm,
|
||||
dbName: "IntKomm",
|
||||
required: false),
|
||||
],
|
||||
))
|
||||
];
|
||||
|
||||
@@ -142,13 +142,15 @@ class _VarTextFieldState extends State<VarTextField> {
|
||||
// ! completely new page
|
||||
|
||||
class Karte extends StatefulWidget {
|
||||
final TextEditingController beiOrtC;
|
||||
final Position currentPosition;
|
||||
final Function(Position) onPositionChange;
|
||||
|
||||
const Karte(
|
||||
{super.key,
|
||||
required this.currentPosition,
|
||||
required this.onPositionChange});
|
||||
required this.onPositionChange,
|
||||
required this.beiOrtC});
|
||||
|
||||
@override
|
||||
KarteState createState() => KarteState();
|
||||
@@ -194,11 +196,13 @@ class KarteState extends State<Karte> {
|
||||
onPressed: () async {
|
||||
|
||||
List<Placemark> placemarks = await placemarkFromCoordinates(selectedPosition!.latitude, selectedPosition!.longitude);
|
||||
print(placemarks);
|
||||
|
||||
if (selectedPosition != null) {
|
||||
|
||||
setState(() {
|
||||
|
||||
widget.beiOrtC.text = placemarks.first.locality!;
|
||||
|
||||
updatedPosition = Position(
|
||||
longitude: selectedPosition!.longitude,
|
||||
latitude: selectedPosition!.latitude,
|
||||
|
||||
Reference in New Issue
Block a user