luc sitzung
This commit is contained in:
2
Todo.txt
2
Todo.txt
@@ -1,4 +1,6 @@
|
|||||||
todo:
|
todo:
|
||||||
|
set theme in settings
|
||||||
|
kontrollintervall in 1 zeile
|
||||||
add feedback to send to server function
|
add feedback to send to server function
|
||||||
im englischen abändern
|
im englischen abändern
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<application
|
<application
|
||||||
android:label="flutter_application_1"
|
android:label="Fotofallen"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
android:icon="@mipmap/ic_launcher">
|
android:icon="@mipmap/ic_launcher">
|
||||||
<activity
|
<activity
|
||||||
|
|||||||
@@ -17,7 +17,11 @@ class AddCamMain extends StatefulWidget {
|
|||||||
final bool isFinished;
|
final bool isFinished;
|
||||||
final Map<String, dynamic>? existingData;
|
final Map<String, dynamic>? existingData;
|
||||||
|
|
||||||
const AddCamMain({super.key, this.isTemplate = false, this.existingData, this.isFinished = false});
|
const AddCamMain(
|
||||||
|
{super.key,
|
||||||
|
this.isTemplate = false,
|
||||||
|
this.existingData,
|
||||||
|
this.isFinished = false});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<AddCamMain> createState() => _AddCamMainState();
|
State<AddCamMain> createState() => _AddCamMainState();
|
||||||
@@ -52,11 +56,9 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
TextEditingController betreuungC = TextEditingController();
|
TextEditingController betreuungC = TextEditingController();
|
||||||
|
|
||||||
String selectedStatus = 'aktiv';
|
String selectedStatus = 'aktiv';
|
||||||
String selectedSTTyp = 'opportunistisch';
|
|
||||||
String selectedFotoFilm = 'Foto';
|
String selectedFotoFilm = 'Foto';
|
||||||
String selectedMEZ = 'Sommerzeit';
|
String selectedMEZ = 'Sommerzeit';
|
||||||
String selectedPlatzung = 'Kirrung';
|
String selectedPlatzung = '';
|
||||||
String selectedBearsafe = 'Nein';
|
|
||||||
|
|
||||||
Position currentPosition = Position(
|
Position currentPosition = Position(
|
||||||
longitude: 10.0,
|
longitude: 10.0,
|
||||||
@@ -89,13 +91,11 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
'BeiOrt': beiOrtC.text,
|
'BeiOrt': beiOrtC.text,
|
||||||
'OrtInfo': ortInfoC.text,
|
'OrtInfo': ortInfoC.text,
|
||||||
'Status': selectedStatus,
|
'Status': selectedStatus,
|
||||||
'STTyp': selectedSTTyp,
|
|
||||||
'FFTyp': ffTypC.text,
|
'FFTyp': ffTypC.text,
|
||||||
'FotoFilm': selectedFotoFilm,
|
'FotoFilm': selectedFotoFilm,
|
||||||
'MEZ': selectedMEZ,
|
'MEZ': selectedMEZ,
|
||||||
'Platzung': selectedPlatzung,
|
'Platzung': selectedPlatzung,
|
||||||
'KSchloNr': kSchloNrC.text,
|
'KSchloNr': kSchloNrC.text,
|
||||||
'Bearsafe': selectedBearsafe,
|
|
||||||
'KontDat': kontDat.toString().split(" ").first,
|
'KontDat': kontDat.toString().split(" ").first,
|
||||||
'AbbauDat': abbauDat.toString().split(" ").first.replaceAll("null", ""),
|
'AbbauDat': abbauDat.toString().split(" ").first.replaceAll("null", ""),
|
||||||
'Auftrag': auftragC.text,
|
'Auftrag': auftragC.text,
|
||||||
@@ -179,16 +179,16 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
beiOrtC.text = widget.existingData!['BeiOrt'];
|
beiOrtC.text = widget.existingData!['BeiOrt'];
|
||||||
ortInfoC.text = widget.existingData!['OrtInfo'];
|
ortInfoC.text = widget.existingData!['OrtInfo'];
|
||||||
selectedStatus = widget.existingData!['Status'];
|
selectedStatus = widget.existingData!['Status'];
|
||||||
selectedSTTyp = widget.existingData!['STTyp'];
|
|
||||||
ffTypC.text = widget.existingData!['FFTyp'];
|
ffTypC.text = widget.existingData!['FFTyp'];
|
||||||
selectedFotoFilm = widget.existingData!['FotoFilm'];
|
selectedFotoFilm = widget.existingData!['FotoFilm'];
|
||||||
selectedMEZ = widget.existingData!['MEZ'];
|
selectedMEZ = widget.existingData!['MEZ'];
|
||||||
selectedPlatzung = widget.existingData!['Platzung'];
|
selectedPlatzung = widget.existingData!['Platzung'];
|
||||||
kSchloNrC.text = widget.existingData!['KSchloNr'];
|
kSchloNrC.text = widget.existingData!['KSchloNr'];
|
||||||
selectedBearsafe = widget.existingData!['Bearsafe'];
|
|
||||||
datum = DateTime.parse(widget.existingData!['Datum']);
|
datum = DateTime.parse(widget.existingData!['Datum']);
|
||||||
kontDat = DateTime.parse(widget.existingData!['KontDat']);
|
kontDat = DateTime.parse(widget.existingData!['KontDat']);
|
||||||
abbauDat = widget.existingData!['AbbauDat'] == "" ? null : DateTime.parse(widget.existingData!['AbbauDat']);
|
abbauDat = widget.existingData!['AbbauDat'] == ""
|
||||||
|
? null
|
||||||
|
: DateTime.parse(widget.existingData!['AbbauDat']);
|
||||||
auftragC.text = widget.existingData!['Auftrag'];
|
auftragC.text = widget.existingData!['Auftrag'];
|
||||||
kontAbspC.text = widget.existingData!['KontAbsp'];
|
kontAbspC.text = widget.existingData!['KontAbsp'];
|
||||||
sonstBemC.text = widget.existingData!['SonstBem'];
|
sonstBemC.text = widget.existingData!['SonstBem'];
|
||||||
@@ -233,6 +233,35 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<dynamic> _showServerErrorDialog() {
|
||||||
|
return showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text(AppLocalizations.of(context)!.servererrortitle),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
|
||||||
|
|
||||||
|
int errorCode = _httpRequest();
|
||||||
|
|
||||||
|
if (errorCode != 201) {
|
||||||
|
Navigator.pop(context);
|
||||||
|
_showServerErrorDialog();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Text(AppLocalizations.of(context)!.sendagain)),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Text(AppLocalizations.of(context)!.cancel))
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> showSaveOptionsDialog() async {
|
Future<void> showSaveOptionsDialog() async {
|
||||||
return showDialog(
|
return showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@@ -252,13 +281,38 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
child: Text(AppLocalizations.of(context)!.template)),
|
child: Text(AppLocalizations.of(context)!.template)),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
_httpRequest();
|
|
||||||
|
int errorCode = _httpRequest();
|
||||||
|
|
||||||
|
if (errorCode != 201) {
|
||||||
saveData();
|
saveData();
|
||||||
|
_showServerErrorDialog();
|
||||||
|
} else {
|
||||||
|
saveData();
|
||||||
|
return showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text(
|
||||||
|
AppLocalizations.of(context)!.successful),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
AppLocalizations.of(context)!.back)),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
Navigator.pushNamedAndRemoveUntil(
|
Navigator.pushNamedAndRemoveUntil(
|
||||||
// ignore: use_build_context_synchronously
|
context, '/home', (route) => false);
|
||||||
context,
|
},
|
||||||
'/home',
|
child: Text(AppLocalizations.of(context)!
|
||||||
(route) => false);
|
.continueB))
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: Text(AppLocalizations.of(context)!.sendtoserver)),
|
child: Text(AppLocalizations.of(context)!.sendtoserver)),
|
||||||
TextButton(
|
TextButton(
|
||||||
@@ -276,7 +330,8 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
context,
|
context,
|
||||||
'/home',
|
'/home',
|
||||||
(route) => false);
|
(route) => false);
|
||||||
}, child: Text(AppLocalizations.of(context)!.justsave)),
|
},
|
||||||
|
child: Text(AppLocalizations.of(context)!.justsave)),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
@@ -287,13 +342,15 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int _httpRequest() {
|
||||||
|
|
||||||
|
|
||||||
void _httpRequest() async {
|
|
||||||
Map<String, dynamic> place = getPlace();
|
Map<String, dynamic> place = getPlace();
|
||||||
|
|
||||||
Methods(jsonEncode(place)).httpRequest();
|
Methods method = Methods();
|
||||||
|
|
||||||
|
method.httpRequest(jsonEncode(place));
|
||||||
|
|
||||||
|
return method.errorCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> saveFile() async {
|
Future<void> saveFile() async {
|
||||||
@@ -310,7 +367,8 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
await prefs.setString('saveDir', selectedDirectory);
|
await prefs.setString('saveDir', selectedDirectory);
|
||||||
|
|
||||||
// ignore: use_build_context_synchronously
|
// ignore: use_build_context_synchronously
|
||||||
File file = File('$selectedDirectory/${AppLocalizations.of(context)!.justplace}-${standortC.text}.txt');
|
File file = File(
|
||||||
|
'$selectedDirectory/${AppLocalizations.of(context)!.justplace}-${standortC.text}.txt');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await file.writeAsString(jsonPlace);
|
await file.writeAsString(jsonPlace);
|
||||||
@@ -346,7 +404,6 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
'Lkr': lkrC,
|
'Lkr': lkrC,
|
||||||
'BeiOrt': beiOrtC,
|
'BeiOrt': beiOrtC,
|
||||||
'Status': TextEditingController(text: selectedStatus),
|
'Status': TextEditingController(text: selectedStatus),
|
||||||
'STTyp': TextEditingController(text: selectedSTTyp),
|
|
||||||
'FFTyp': ffTypC,
|
'FFTyp': ffTypC,
|
||||||
'FotoFilm': TextEditingController(text: selectedFotoFilm),
|
'FotoFilm': TextEditingController(text: selectedFotoFilm),
|
||||||
'MEZ': TextEditingController(text: selectedMEZ),
|
'MEZ': TextEditingController(text: selectedMEZ),
|
||||||
@@ -418,14 +475,6 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 1,
|
height: 1,
|
||||||
),
|
),
|
||||||
STTyp(
|
|
||||||
initialSTTyp: selectedSTTyp,
|
|
||||||
onSTTypChanged: (sttyp) {
|
|
||||||
setState(() {
|
|
||||||
selectedSTTyp = sttyp;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 5,
|
height: 5,
|
||||||
),
|
),
|
||||||
@@ -488,21 +537,6 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Align(
|
|
||||||
alignment: Alignment.bottomLeft,
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(AppLocalizations.of(context)!.bearsafe),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
Bearsafe(
|
|
||||||
initialBearsafe: selectedBearsafe,
|
|
||||||
onBearsafeChanged: (bearsafe) {
|
|
||||||
setState(() {
|
|
||||||
selectedBearsafe = bearsafe;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 15,
|
height: 15,
|
||||||
),
|
),
|
||||||
@@ -530,20 +564,24 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
title: Text(AppLocalizations.of(context)!.secondstep),
|
title: Text(AppLocalizations.of(context)!.secondstep),
|
||||||
content: Column(
|
content: Column(
|
||||||
children: [
|
children: [
|
||||||
Align(
|
Row(
|
||||||
alignment: Alignment.bottomLeft,
|
children: [
|
||||||
child: Text(currentPosition.latitude.toString())),
|
Column(
|
||||||
Align(
|
children: [
|
||||||
alignment: Alignment.bottomLeft,
|
Text(currentPosition.latitude.toString()),
|
||||||
child: Text(currentPosition.longitude.toString())),
|
|
||||||
Align(
|
Text(currentPosition.longitude.toString()),
|
||||||
alignment: Alignment.bottomLeft,
|
|
||||||
child: ElevatedButton(
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(width: 15,),
|
||||||
|
ElevatedButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final result = await Navigator.of(context)
|
final result = await Navigator.of(context)
|
||||||
.push<LatLng>(
|
.push<LatLng>(
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
return Karte(
|
return Karte(
|
||||||
|
ortInfoC: ortInfoC,
|
||||||
beiOrtC: beiOrtC,
|
beiOrtC: beiOrtC,
|
||||||
currentPosition: currentPosition,
|
currentPosition: currentPosition,
|
||||||
onPositionChange: (updatedPosition) {
|
onPositionChange: (updatedPosition) {
|
||||||
@@ -571,6 +609,7 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Text(AppLocalizations.of(context)!.openMap)),
|
child: Text(AppLocalizations.of(context)!.openMap)),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
VarTextField(
|
VarTextField(
|
||||||
textController: bLandC,
|
textController: bLandC,
|
||||||
@@ -609,6 +648,7 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
Platzung(
|
Platzung(
|
||||||
|
initialPlatzung: selectedPlatzung,
|
||||||
onPlatzungChanged: (platzung) {
|
onPlatzungChanged: (platzung) {
|
||||||
setState(() {
|
setState(() {
|
||||||
selectedPlatzung = platzung;
|
selectedPlatzung = platzung;
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ class _VarTextFieldState extends State<VarTextField> {
|
|||||||
|
|
||||||
class Karte extends StatefulWidget {
|
class Karte extends StatefulWidget {
|
||||||
final TextEditingController beiOrtC;
|
final TextEditingController beiOrtC;
|
||||||
|
final TextEditingController ortInfoC;
|
||||||
final Position currentPosition;
|
final Position currentPosition;
|
||||||
final Function(Position) onPositionChange;
|
final Function(Position) onPositionChange;
|
||||||
|
|
||||||
@@ -154,7 +155,7 @@ class Karte extends StatefulWidget {
|
|||||||
{super.key,
|
{super.key,
|
||||||
required this.currentPosition,
|
required this.currentPosition,
|
||||||
required this.onPositionChange,
|
required this.onPositionChange,
|
||||||
required this.beiOrtC});
|
required this.beiOrtC, required this.ortInfoC});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
KarteState createState() => KarteState();
|
KarteState createState() => KarteState();
|
||||||
@@ -196,10 +197,12 @@ class KarteState extends State<Karte> {
|
|||||||
List<Placemark> placemarks = await placemarkFromCoordinates(
|
List<Placemark> placemarks = await placemarkFromCoordinates(
|
||||||
selectedPosition!.latitude,
|
selectedPosition!.latitude,
|
||||||
selectedPosition!.longitude);
|
selectedPosition!.longitude);
|
||||||
|
print(placemarks);
|
||||||
|
|
||||||
if (selectedPosition != null) {
|
if (selectedPosition != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
widget.beiOrtC.text = placemarks.first.locality!;
|
widget.beiOrtC.text = placemarks.first.locality!;
|
||||||
|
widget.ortInfoC.text = placemarks.first.street!;
|
||||||
|
|
||||||
updatedPosition = Position(
|
updatedPosition = Position(
|
||||||
longitude: selectedPosition!.longitude,
|
longitude: selectedPosition!.longitude,
|
||||||
@@ -307,7 +310,7 @@ class _DatumState extends State<Datum> {
|
|||||||
children: [
|
children: [
|
||||||
Row(children: [
|
Row(children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 125,
|
width: 140,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final date = await pickDate();
|
final date = await pickDate();
|
||||||
@@ -468,10 +471,12 @@ class _STTypState extends State<STTyp> {
|
|||||||
|
|
||||||
class Platzung extends StatefulWidget {
|
class Platzung extends StatefulWidget {
|
||||||
final Function(String) onPlatzungChanged;
|
final Function(String) onPlatzungChanged;
|
||||||
|
final String? initialPlatzung;
|
||||||
|
|
||||||
|
|
||||||
const Platzung(
|
const Platzung(
|
||||||
{super.key,
|
{super.key,
|
||||||
required this.onPlatzungChanged,
|
required this.onPlatzungChanged, this.initialPlatzung,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -481,6 +486,14 @@ class Platzung extends StatefulWidget {
|
|||||||
class _PlatzungState extends State<Platzung> {
|
class _PlatzungState extends State<Platzung> {
|
||||||
String? _selectedPlatzung;
|
String? _selectedPlatzung;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
if (widget.initialPlatzung != "") {
|
||||||
|
_selectedPlatzung = widget.initialPlatzung;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -709,67 +722,6 @@ class _MEZState extends State<MEZ> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bearsafe
|
|
||||||
|
|
||||||
class Bearsafe extends StatefulWidget {
|
|
||||||
final Function(String) onBearsafeChanged;
|
|
||||||
final String initialBearsafe;
|
|
||||||
|
|
||||||
const Bearsafe(
|
|
||||||
{super.key,
|
|
||||||
required this.onBearsafeChanged,
|
|
||||||
this.initialBearsafe = 'Nein'});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<Bearsafe> createState() => _BearsafeState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _BearsafeState extends State<Bearsafe> {
|
|
||||||
String? _selectedBearsafe;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
_selectedBearsafe = widget.initialBearsafe;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
ListTile(
|
|
||||||
visualDensity: const VisualDensity(vertical: -4),
|
|
||||||
title: Text(AppLocalizations.of(context)!.nein),
|
|
||||||
leading: Radio<String>(
|
|
||||||
value: 'Nein',
|
|
||||||
groupValue: _selectedBearsafe,
|
|
||||||
onChanged: (value) {
|
|
||||||
setState(() {
|
|
||||||
_selectedBearsafe = value;
|
|
||||||
widget.onBearsafeChanged(value!);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
visualDensity: const VisualDensity(vertical: -4),
|
|
||||||
title: Text(AppLocalizations.of(context)!.ja),
|
|
||||||
leading: Radio<String>(
|
|
||||||
value: 'Ja',
|
|
||||||
groupValue: _selectedBearsafe,
|
|
||||||
onChanged: (value) {
|
|
||||||
setState(() {
|
|
||||||
_selectedBearsafe = value;
|
|
||||||
widget.onBearsafeChanged(value!);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// KontDat
|
// KontDat
|
||||||
|
|
||||||
class KontDat extends StatefulWidget {
|
class KontDat extends StatefulWidget {
|
||||||
@@ -790,7 +742,7 @@ class _KontDatState extends State<KontDat> {
|
|||||||
children: [
|
children: [
|
||||||
Row(children: [
|
Row(children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 125,
|
width: 140,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final date = await pickDate();
|
final date = await pickDate();
|
||||||
@@ -847,7 +799,7 @@ class _AbbauDatState extends State<AbbauDat> {
|
|||||||
children: [
|
children: [
|
||||||
Row(children: [
|
Row(children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 125,
|
width: 140,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final date = await pickDate();
|
final date = await pickDate();
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ import 'addCam/add_cam_main.dart';
|
|||||||
|
|
||||||
// * The homepage where you can choose to add something or view the database entries
|
// * The homepage where you can choose to add something or view the database entries
|
||||||
|
|
||||||
|
|
||||||
class HomePage extends StatelessWidget {
|
class HomePage extends StatelessWidget {
|
||||||
const HomePage({super.key});
|
const HomePage({super.key});
|
||||||
|
|
||||||
|
|
||||||
void _sendFile() async {
|
void _sendFile() async {
|
||||||
FilePickerResult? result = await FilePicker.platform.pickFiles();
|
FilePickerResult? result = await FilePicker.platform.pickFiles();
|
||||||
|
|
||||||
@@ -18,17 +18,15 @@ class HomePage extends StatelessWidget {
|
|||||||
File file = File(result.files.single.path!);
|
File file = File(result.files.single.path!);
|
||||||
String content = await file.readAsString();
|
String content = await file.readAsString();
|
||||||
|
|
||||||
Methods(content).httpRequest();
|
Methods().httpRequest(content);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: Text(AppLocalizations.of(context)!.homePageTitle),
|
appBar: AppBar(
|
||||||
|
title: Text(AppLocalizations.of(context)!.homePageTitle),
|
||||||
actions: [
|
actions: [
|
||||||
PopupMenuButton(
|
PopupMenuButton(
|
||||||
onSelected: (value) {
|
onSelected: (value) {
|
||||||
@@ -41,7 +39,8 @@ class HomePage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
value: '/introScreen',
|
value: '/introScreen',
|
||||||
child: Text(AppLocalizations.of(context)!.showloginscreen))
|
child:
|
||||||
|
Text(AppLocalizations.of(context)!.showloginscreen))
|
||||||
])
|
])
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -52,7 +51,12 @@ class HomePage extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
|
const SizedBox(height: 30,),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
minimumSize: const Size(250, 40),
|
||||||
|
padding: const EdgeInsets.fromLTRB(10, 5, 10, 5),
|
||||||
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
@@ -60,11 +64,22 @@ class HomePage extends StatelessWidget {
|
|||||||
builder: (context) => const AddCamMain()));
|
builder: (context) => const AddCamMain()));
|
||||||
},
|
},
|
||||||
child: Text(AppLocalizations.of(context)!.addplace)),
|
child: Text(AppLocalizations.of(context)!.addplace)),
|
||||||
ElevatedButton(onPressed: () => Navigator.pushNamed(context, '/viewCams'),
|
const SizedBox(height: 10,),
|
||||||
|
ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
minimumSize: const Size(250, 40)
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.pushNamed(context, '/viewCams'),
|
||||||
child: Text(AppLocalizations.of(context)!.viewplaces)),
|
child: Text(AppLocalizations.of(context)!.viewplaces)),
|
||||||
ElevatedButton(onPressed: () {
|
const SizedBox(height: 10,),
|
||||||
|
ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
minimumSize: const Size(250, 40)
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
_sendFile();
|
_sendFile();
|
||||||
}, child: Text(AppLocalizations.of(context)!.sendfile))
|
},
|
||||||
|
child: Text(AppLocalizations.of(context)!.sendfile))
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -93,5 +93,9 @@
|
|||||||
"justplace": "Standort",
|
"justplace": "Standort",
|
||||||
"justsave": "Nur speichern",
|
"justsave": "Nur speichern",
|
||||||
"finishedentrie": "Bereits fertiger Eintrag",
|
"finishedentrie": "Bereits fertiger Eintrag",
|
||||||
"justdelete": "Löschen"
|
"justdelete": "Löschen",
|
||||||
|
"servererrortitle": "Serverfehler",
|
||||||
|
"sendagain": "Nochmal senden",
|
||||||
|
"successful": "Erfolgreich",
|
||||||
|
"back": "Zurück"
|
||||||
}
|
}
|
||||||
@@ -452,6 +452,26 @@
|
|||||||
"justdelete": "Delete",
|
"justdelete": "Delete",
|
||||||
"@justdelete": {
|
"@justdelete": {
|
||||||
"description": "just delete action pane label"
|
"description": "just delete action pane label"
|
||||||
|
},
|
||||||
|
|
||||||
|
"servererrortitle": "Server Error",
|
||||||
|
"@servererrortitle": {
|
||||||
|
"description": "server error alert dialog title"
|
||||||
|
},
|
||||||
|
|
||||||
|
"sendagain": "Send again",
|
||||||
|
"@sendagain": {
|
||||||
|
"description": "send again option"
|
||||||
|
},
|
||||||
|
|
||||||
|
"successful": "successful",
|
||||||
|
"@successful": {
|
||||||
|
"description": "successful alert dialog title"
|
||||||
|
},
|
||||||
|
|
||||||
|
"back": "Back",
|
||||||
|
"@back": {
|
||||||
|
"description": "back alert dialog option"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -21,6 +21,7 @@ void main() async {
|
|||||||
bool isFirstLaunch = prefs.getBool('isFirstLaunch') ?? true;
|
bool isFirstLaunch = prefs.getBool('isFirstLaunch') ?? true;
|
||||||
await prefs.setString('kTage1', "28");
|
await prefs.setString('kTage1', "28");
|
||||||
await prefs.setString('kTage2', "48");
|
await prefs.setString('kTage2', "48");
|
||||||
|
await prefs.setString('apiAddress', 'http://192.168.1.106/www.dbb-wolf.de/data/app24.php');
|
||||||
runApp(MyApp(isFirstLaunch: isFirstLaunch));
|
runApp(MyApp(isFirstLaunch: isFirstLaunch));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,9 +30,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 AUTOINCREMENT, CID TEXT, 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, KTage1 INTEGER, KTage2 INTEGER, ProtoAm DATE, IntKomm TEXT, DECLNG DECIMALS(4,8), DECLAT DECIMALS(4,8), Sent INTEGER DEFAULT 0)');
|
'CREATE TABLE place (ID INTEGER PRIMARY KEY AUTOINCREMENT, CID TEXT, Standort TEXT, Rudel TEXT, Datum DATE, Adresse1 TEXT, Adresse2 TEXT, Adresse3 TEXT, BLand TEXT, Lkr TEXT, BeiOrt TEXT, OrtInfo TEXT, Status TEXT, FFTyp TEXT, FotoFilm TEXT, MEZ TEXT, Platzung TEXT, KSchloNr TEXT, KontDat DATE, Betreuung TEXT, AbbauDat DATE, Auftrag TEXT, KontAbsp TEXT, SonstBem TEXT, FKontakt1 TEXT, FKontakt2 TEXT, FKontakt3 TEXT, 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 AUTOINCREMENT, CID TEXT, 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, KTage1 INTEGER, KTage2 INTEGER, ProtoAm DATE, IntKomm TEXT, DECLNG DECIMALS(4,8), DECLAT DECIMALS(4,8))');
|
'CREATE TABLE templates (ID INTEGER PRIMARY KEY AUTOINCREMENT, CID TEXT, Standort TEXT, Rudel TEXT, Datum DATE, Adresse1 TEXT, Adresse2 TEXT, Adresse3 TEXT, BLand TEXT, Lkr TEXT, BeiOrt TEXT, OrtInfo TEXT, Status TEXT, FFTyp TEXT, FotoFilm TEXT, MEZ TEXT, Platzung TEXT, KSchloNr TEXT, KontDat DATE, Betreuung TEXT, AbbauDat DATE, Auftrag TEXT, KontAbsp TEXT, SonstBem TEXT, FKontakt1 TEXT, FKontakt2 TEXT, FKontakt3 TEXT, KTage1 INTEGER, KTage2 INTEGER, ProtoAm DATE, IntKomm TEXT, DECLNG DECIMALS(4,8), DECLAT DECIMALS(4,8))');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to add a finished entrie
|
// Function to add a finished entrie
|
||||||
|
|||||||
@@ -1,45 +1,43 @@
|
|||||||
import 'dart:convert';
|
// ignore_for_file: avoid_print
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:fforte/other/db_helper.dart';
|
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
class Methods {
|
class Methods {
|
||||||
String httpData;
|
int? _errorCode;
|
||||||
|
|
||||||
Methods(this.httpData);
|
|
||||||
|
|
||||||
void httpRequest() async {
|
int get errorCode => _errorCode ?? 0;
|
||||||
|
|
||||||
|
|
||||||
|
Methods();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void httpRequest(String httpData) async {
|
||||||
// print(jsonEncode(place));
|
// print(jsonEncode(place));
|
||||||
|
|
||||||
final dio = Dio();
|
final dio = Dio();
|
||||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
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(prefs.getString('apiAddress') ?? "",
|
response = await dio.post(prefs.getString('apiAddress') ?? "",
|
||||||
data: jsonEncode(httpData));
|
data: jsonEncode(httpData));
|
||||||
// print(jsonEncode(httpData));
|
|
||||||
|
// ignore: unused_catch_clause
|
||||||
} on DioException catch (e) {
|
} on DioException catch (e) {
|
||||||
if (e.response?.statusCode == 500) {
|
_errorCode = response.statusCode;
|
||||||
print('-------------------------');
|
print('is hier. var: ${_errorCode}');
|
||||||
print('code 500');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
_errorCode = response.statusCode;
|
||||||
|
print('is hier 2. var: ${_errorCode}');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (response.statusCode == 201) {
|
|
||||||
print("------------------");
|
|
||||||
print(response.statusCode);
|
|
||||||
var placeDB = DBHelper();
|
|
||||||
|
|
||||||
await placeDB.updateSent();
|
|
||||||
} else {
|
|
||||||
print("----------------");
|
|
||||||
print("Anderer code");
|
|
||||||
print(response.statusCode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
63
pubspec.yaml
63
pubspec.yaml
@@ -1,32 +1,15 @@
|
|||||||
name: fforte
|
name: fforte
|
||||||
description: A new Flutter project.
|
description: App to save locations of wildlife cameras
|
||||||
# The following line prevents the package from being accidentally published to
|
|
||||||
# pub.dev using `flutter pub publish`. This is preferred for private packages.
|
|
||||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
publish_to: 'none'
|
||||||
|
|
||||||
# The following defines the version and build number for your application.
|
|
||||||
# A version number is three numbers separated by dots, like 1.2.43
|
|
||||||
# followed by an optional build number separated by a +.
|
|
||||||
# Both the version and the builder number may be overridden in flutter
|
|
||||||
# build by specifying --build-name and --build-number, respectively.
|
|
||||||
# In Android, build-name is used as versionName while build-number used as versionCode.
|
|
||||||
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
|
|
||||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
|
|
||||||
# Read more about iOS versioning at
|
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
|
||||||
# In Windows, build-name is used as the major, minor, and patch parts
|
|
||||||
# of the product and file versions while build-number is used as the build suffix.
|
|
||||||
version: 1.0.0+1
|
version: 1.0.0+1
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.0.5 <4.0.0'
|
sdk: '>=3.0.5 <4.0.0'
|
||||||
|
|
||||||
# Dependencies specify other packages that your package needs in order to work.
|
|
||||||
# To automatically upgrade your package dependencies to the latest versions
|
|
||||||
# consider running `flutter pub upgrade --major-versions`. Alternatively,
|
|
||||||
# dependencies can be manually updated by changing the version numbers below to
|
|
||||||
# the latest version available on pub.dev. To see which dependencies have newer
|
|
||||||
# versions available, run `flutter pub outdated`.
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flex_color_scheme: ^7.2.0
|
flex_color_scheme: ^7.2.0
|
||||||
flutter:
|
flutter:
|
||||||
@@ -56,39 +39,13 @@ dev_dependencies:
|
|||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
||||||
# For information on the generic Dart part of this file, see the
|
|
||||||
# following page: https://dart.dev/tools/pub/pubspec
|
|
||||||
# The following section is specific to Flutter packages.
|
|
||||||
flutter:
|
flutter:
|
||||||
generate: true
|
generate: true
|
||||||
# The following line ensures that the Material Icons font is
|
|
||||||
# included with your application, so that you can use the icons in
|
|
||||||
# the material Icons class.
|
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
# To add assets to your application, add an assets section, like this:
|
|
||||||
|
|
||||||
assets:
|
assets:
|
||||||
- assets/images/
|
- assets/images/
|
||||||
# - images/a_dot_ham.jpeg
|
|
||||||
# An image asset can refer to one or more resolution-specific "variants", see
|
|
||||||
# https://flutter.dev/assets-and-images/#resolution-aware
|
|
||||||
# For details regarding adding assets from package dependencies, see
|
|
||||||
# https://flutter.dev/assets-and-images/#from-packages
|
|
||||||
# To add custom fonts to your application, add a fonts section here,
|
|
||||||
# in this "flutter" section. Each entry in this list should have a
|
|
||||||
# "family" key with the font family name, and a "fonts" key with a
|
|
||||||
# list giving the asset and other descriptors for the font. For
|
|
||||||
# example:
|
|
||||||
# fonts:
|
|
||||||
# - family: Schyler
|
|
||||||
# fonts:
|
|
||||||
# - asset: fonts/Schyler-Regular.ttf
|
|
||||||
# - asset: fonts/Schyler-Italic.ttf
|
|
||||||
# style: italic
|
|
||||||
# - family: Trajan Pro
|
|
||||||
# fonts:
|
|
||||||
# - asset: fonts/TrajanPro.ttf
|
|
||||||
# - asset: fonts/TrajanPro_Bold.ttf
|
|
||||||
# weight: 700
|
|
||||||
#
|
|
||||||
# For details regarding fonts from package dependencies,
|
|
||||||
# see https://flutter.dev/custom-fonts/#from-packages
|
|
||||||
|
|||||||
Reference in New Issue
Block a user