sitzung luc

This commit is contained in:
Nico
2024-03-15 19:22:46 +01:00
parent 624bb38846
commit d157757893
12 changed files with 158 additions and 82 deletions

View File

@@ -10,6 +10,7 @@ import 'package:geolocator/geolocator.dart';
import 'package:intl/intl.dart';
import 'package:latlong2/latlong.dart';
import 'package:animations/animations.dart';
import 'package:http/http.dart' as http;
class AddCamMain extends StatefulWidget {
final bool isTemplate;
@@ -49,10 +50,10 @@ class _AddCamMainState extends State<AddCamMain> {
TextEditingController intKommC = TextEditingController();
TextEditingController kontSumC = TextEditingController();
String selectedStatus = 'inaktiv';
String selectedStatus = 'aktiv';
String selectedSTTyp = 'opportunistisch';
String selectedFotoFilm = 'foto';
String selectedMEZ = 'mez';
String selectedMEZ = 'sommerzeit';
String selectedPlatzung = 'kirrung';
String selectedBearsafe = 'nein';
@@ -69,11 +70,11 @@ class _AddCamMainState extends State<AddCamMain> {
headingAccuracy: 0.0);
String datumS = DateFormat('yyyy-MM-dd').format(DateTime.now());
String kontDatS = DateFormat('yyyy-mm-dd').format(DateTime.now());
String abbauDatS = DateFormat('yyyy-mm-dd').format(DateTime.now());
String ausVonS = DateFormat('yyyy-mm-dd').format(DateTime(2000));
String ausBisS = DateFormat('yyyy-mm-dd').format(DateTime(2000));
String protoAmS = DateFormat('yyyy-mm-dd').format(DateTime.now());
String kontDatS = DateFormat('yyyy-MM-dd').format(DateTime.now());
String abbauDatS = DateFormat('yyyy-MM-dd').format(DateTime.now());
String ausVonS = DateFormat('yyyy-MM-dd').format(DateTime(2000));
String ausBisS = DateFormat('yyyy-MM-dd').format(DateTime(2000));
String protoAmS = DateFormat('yyyy-MM-dd').format(DateTime.now());
DateTime? ausBis;
DateTime? ausVon;
DateTime abbauDat = DateTime.now();
@@ -207,15 +208,17 @@ class _AddCamMainState extends State<AddCamMain> {
title: Text(AppLocalizations.of(context)!.savemethod),
actions: [
TextButton(
onPressed: () {
Navigator.pushNamedAndRemoveUntil(context, '/home', (route) => false);
onPressed: () async {
_httpRequest();
// Navigator.pushNamedAndRemoveUntil(context, '/home', (route) => false);
},
child: Text(AppLocalizations.of(context)!.sendtoserver)),
TextButton(
onPressed: () async {
await saveFile();
// ignore: use_build_context_synchronously
Navigator.pushNamedAndRemoveUntil(context, '/home', (route) => false);
Navigator.pushNamedAndRemoveUntil(
context, '/home', (route) => false);
},
child: Text(AppLocalizations.of(context)!.saveasfile))
],
@@ -223,9 +226,55 @@ class _AddCamMainState extends State<AddCamMain> {
});
}
void _httpRequest() async {
Map<String, dynamic> place = {
'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(Uri.parse("http://192.168.178.30/www.dbb-wolf.de/data/_nicoapi.php"),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
},
body: jsonEncode(place));
print(response);
}
Future<void> saveFile() async {
String? selectedDirectory = await FilePicker.platform.getDirectoryPath();
Map<String, dynamic> place = {
'CID': id.text,
'Rudel': rudelC.text,
@@ -270,8 +319,7 @@ class _AddCamMainState extends State<AddCamMain> {
File file = File('$selectedDirectory/cam-${id.text}.txt');
await file
.writeAsString(jsonPlace);
await file.writeAsString(jsonPlace);
// ignore: use_build_context_synchronously
ScaffoldMessenger.of(context).showSnackBar(
@@ -287,7 +335,6 @@ class _AddCamMainState extends State<AddCamMain> {
'BLand': bLandC,
'Lkr': lkrC,
'BeiOrt': beiOrtC,
'OrtInfo': ortInfoC,
'Status': TextEditingController(text: selectedStatus),
'STTyp': TextEditingController(text: selectedSTTyp),
'FFTyp': ffTypC,
@@ -572,7 +619,7 @@ class _AddCamMainState extends State<AddCamMain> {
alignment: Alignment.bottomLeft,
child: Row(
children: [
Text(AppLocalizations.of(context)!.sommerzeit),
Text(AppLocalizations.of(context)!.zeiteinstellung),
const Text(
'*',
style: TextStyle(color: Colors.red),
@@ -685,7 +732,7 @@ class _AddCamMainState extends State<AddCamMain> {
],
)),
Step(
title: Text(AppLocalizations.of(context)!.secondStep),
title: Text(AppLocalizations.of(context)!.kontakt),
content: Column(
children: [
const SizedBox(
@@ -764,6 +811,7 @@ class _AddCamMainState extends State<AddCamMain> {
final isLastStep = currentStep == getSteps().length - 1;
if (!isLastStep) {
// ! saveTemplate();
setState(() {
currentStep += 1;
});
@@ -774,11 +822,14 @@ class _AddCamMainState extends State<AddCamMain> {
();
return;
} else if (empty == false) {
// throw const FormatException(("Speichert"));
saveData();
await showSaveOptionsDialog();
Navigator.pushNamedAndRemoveUntil(
// ignore: use_build_context_synchronously
context, '/home', (route) => false);
context,
'/home',
(route) => false);
}
}
},

View File

@@ -351,9 +351,9 @@ class _DatumState extends State<Datum> {
Text(
'${datum?.day}. ${datum?.month}. ${datum?.year}',
),
const SizedBox(
height: 8,
),
//const SizedBox(
// height: 2,
//),
ElevatedButton(
onPressed: () async {
final date = await pickDate();
@@ -949,18 +949,7 @@ class _OrtInfoState extends State<OrtInfo> {
flex: 2,
child: TextField(
decoration: InputDecoration(
hintText: AppLocalizations.of(context)!.ortinfo,
enabledBorder: widget.ortInfoC.text.isEmpty
? const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.red))
: const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.green)),
focusedBorder: widget.ortInfoC.text.isEmpty
? const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.red))
: const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.green)),
),
hintText: AppLocalizations.of(context)!.ortinfo,),
controller: widget.ortInfoC,
onChanged: (value) => setState(() {
widget.ortInfoC.text = value;
@@ -1417,7 +1406,7 @@ class MEZ extends StatefulWidget {
final Function(String) onMEZChanged;
final String initialMEZ;
const MEZ({super.key, required this.onMEZChanged, this.initialMEZ = 'aktiv'});
const MEZ({super.key, required this.onMEZChanged, this.initialMEZ = 'sommerzeit'});
@override
State<MEZ> createState() => _MEZState();
@@ -1438,9 +1427,9 @@ class _MEZState extends State<MEZ> {
children: [
ListTile(
visualDensity: const VisualDensity(vertical: -4),
title: Text(AppLocalizations.of(context)!.mez),
title: Text(AppLocalizations.of(context)!.sommerzeit),
leading: Radio<String>(
value: 'mez',
value: 'sommerzeit',
groupValue: _selectedMEZ,
onChanged: (value) {
setState(() {
@@ -1452,9 +1441,9 @@ class _MEZState extends State<MEZ> {
),
ListTile(
visualDensity: const VisualDensity(vertical: -4),
title: Text(AppLocalizations.of(context)!.unklar),
title: Text(AppLocalizations.of(context)!.winterzeit),
leading: Radio<String>(
value: 'unklar',
value: 'winterzeit',
groupValue: _selectedMEZ,
onChanged: (value) {
setState(() {

View File

@@ -5,30 +5,31 @@
"uncompleted": "Unvollständig",
"deleteEverything": "Alles löschen?",
"deleteEverythingContent": "Alle Kameras werden lokal gelöscht!",
"camLink": "Link zur Kamera",
"firstStep": "Kamera, Rudel",
"secondStep": "Datum, Kontakt",
"date": "Datum",
"camLink": "ID der Kamera",
"firstStep": "KAMERA, TERRITORIUM",
"secondStep": "DATUM, KONTAKT",
"date": "DATUM",
"kontakt": "KONTAKT",
"status": "Status",
"viewCamsAppbar": "Kameras ansehen",
"locations": "Standort",
"rudel": "Rudel",
"locations": "STANDORT",
"rudel": "Territorium",
"namevorname": "Name",
"plzort": "PLZ und Ort",
"emailtel": "Email und/oder Telefon",
"bland": "Bundesland",
"lkr": "Landkreis",
"beiort": "Bei Ort",
"ortinfo": "Ort Info",
"ortinfo": "Nähere Ortsbeschreibung",
"aktiv": "Aktiv",
"inaktiv": "Inaktiv",
"opportunistisch": "opportunistisch",
"systematic": "systematisch",
"fftyp": "Fotofallen typ",
"fftyp": "Fotofallentyp",
"foto": "Foto",
"film": "Film",
"mez": "MEZ",
"unklar": "Unklar",
"sommerzeit": "Sommerzeit",
"winterzeit": "Winterzeit",
"intkomm": "Interne Kommunikation",
"kirrung": "Kirrung",
"wasserstelle": "Wasserstelle",
@@ -38,10 +39,10 @@
"kschlonr": "KSchloss Nummer",
"nein": "Nein",
"ja": "Ja",
"pickkontdat": "KontDat Auswählen",
"pickabbaudat": "Abbau datum Auswählen",
"platzung": "Platzung",
"sommerzeit": "sommerzeit",
"pickkontdat": "Datum Kontrolle",
"pickabbaudat": "Datum Abbau",
"platzung": "Platzierung",
"zeiteinstellung": "Zeiteinstellung",
"auftrag": "Auftrag",
"absprachen": "Absprachen",
"sonstbemerkungen": "Sonstige Bemerkungen",
@@ -49,29 +50,29 @@
"fkontakt2": "FKontakt 2",
"fkontakt3": "FKontakt 3",
"hofgarten": "Hof/Garten",
"altstort": "AltStOrt",
"altstort": "Alter Standort",
"wiesefeld": "Wiese/Feld/offenfläche",
"ausvon": "Aus von",
"nichts": "Nichts",
"nichts": "---",
"ausbis": "Aus Bis",
"ktage1": "KTage 1",
"ktage2": "KTage 2",
"eugrid": "EUGrid",
"pickDate": "Datum Auswählen",
"pickTime": "Zeit Auswählen",
"pickDate": "Datum Aufstelung",
"pickTime": "Zeit auswählen",
"delAll": "Alle Kameras löschen",
"fieldEmpty": "Folgendes Felde ist leer:",
"fieldEmpty": "Folgendes Feld ist leer:",
"cancel": "Abbrechen",
"template": "Als Vorlage speichern",
"openMap": "Karte öffnen",
"saveMap": "Speichern und Schleßen",
"saveMap": "Speichern und Schließen",
"locationDisabled": "Standort ausgeschaltet. Bitte einschalten",
"locationForbidden": "Zugriff auf Standort verweigert. Es ist empfohlen dies zu erlauben",
"map": "Karte",
"markerSet": "Marker gesetzt auf",
"kontsum": "Kontrollsumme",
"bearsafe": "Bärensafe",
"sttyp": "STTyp",
"bearsafe": "Bearsafe",
"sttyp": "Status",
"ort": "Ort",
"continueB": "Weiter",
"settings": "Einstellungen",

View File

@@ -132,14 +132,14 @@
"description": "film radiobutton"
},
"mez": "MEZ",
"@mez": {
"description": "mez radiobutton"
"sommerzeit": "Summertime",
"@sommerzeit": {
"description": "summertime radiobutton"
},
"unklar": "unclear",
"@unklar": {
"description": "unclear radiobutton"
"winterzeit": "winterzeit",
"@winterzeit": {
"description": "winterzeit radiobutton"
},
"kirrung": "Kirrung",
@@ -197,9 +197,14 @@
"description": "platzung header"
},
"sommerzeit": "Summertime",
"@sommerzeit": {
"description": "mez summertime header"
"zeiteinstellung": "Timesetting",
"@zeiteinstellung": {
"description": "summertime header"
},
"kontakt": "Contact",
"@kontakt": {
"description": "contact header"
},
"auftrag": "Order",

View File

@@ -31,7 +31,7 @@ class MyApp extends StatelessWidget {
return MaterialApp(
title: 'FFOrte',
theme:
FlexThemeData.light(scheme: FlexScheme.greenM3, useMaterial3: true),
FlexThemeData.light(scheme: FlexScheme.gold, useMaterial3: true),
darkTheme:
FlexThemeData.dark(scheme: FlexScheme.greenM3, useMaterial3: true),
themeMode: ThemeMode.system,

View File

@@ -47,6 +47,11 @@ class _SettingsState extends State<Settings> {
await prefs.setString('nameVorname', nameVornameC.text);
}
void _saveBLand() async {
final SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setString('bLand', bLandC.text);
}
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -95,6 +100,7 @@ class _SettingsState extends State<Settings> {
child: const Icon(Icons.save),
onPressed: () {
_saveName();
_saveBLand();
}),
);
}

View File

@@ -133,7 +133,7 @@ class _ViewCamsState extends State<ViewCams> {
Map<String, dynamic> place =
snapshot.data![index];
return ListTile(
title: Text('Place ${index + 1}'),
title: Text('Standort ${index + 1}'),
subtitle: Text(
'ID: ${place['CID']} DATUM: ${place['Datum']}'),
trailing: Checkbox(
@@ -199,7 +199,7 @@ class _ViewCamsState extends State<ViewCams> {
Text(
'${AppLocalizations.of(context)!.ausbis}: ${place['AusBis']}'),
Text(
'${AppLocalizations.of(context)!.mez}: ${place['MEZ']}'),
'${AppLocalizations.of(context)!.sommerzeit}: ${place['MEZ']}'),
Text(
'${AppLocalizations.of(context)!.kontsum}: ${place['KontSum']}'),
Text(