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

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