outsourced all methods and dialogs as far as possible (I think)
This commit is contained in:
228
lib/screens/excursion/widgets/anzahlen.dart
Normal file
228
lib/screens/excursion/widgets/anzahlen.dart
Normal file
@@ -0,0 +1,228 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
class Anzahlen extends StatefulWidget {
|
||||
final TextEditingController losungAnz;
|
||||
final TextEditingController losungGes;
|
||||
final TextEditingController losungGen;
|
||||
final TextEditingController urinAnz;
|
||||
final TextEditingController urinGen;
|
||||
final TextEditingController oestrAnz;
|
||||
final TextEditingController oestrGen;
|
||||
final TextEditingController haarAnz;
|
||||
final TextEditingController haarGen;
|
||||
|
||||
const Anzahlen(
|
||||
{super.key,
|
||||
required this.losungAnz,
|
||||
required this.losungGes,
|
||||
required this.losungGen,
|
||||
required this.urinAnz,
|
||||
required this.urinGen,
|
||||
required this.oestrAnz,
|
||||
required this.oestrGen,
|
||||
required this.haarAnz,
|
||||
required this.haarGen});
|
||||
|
||||
@override
|
||||
AnzahlenState createState() => AnzahlenState();
|
||||
}
|
||||
|
||||
class AnzahlenState extends State<Anzahlen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.anzahlLosungen)),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft, child: TextField()),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.davonEingesammelt)),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft, child: TextField()),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 6,
|
||||
child: Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.davonGenetikproben),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft, child: TextField()),
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
height: 40,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(AppLocalizations.of(context)!
|
||||
.anzahlUrinMakierstellen)),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft, child: TextField()),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(AppLocalizations.of(context)!
|
||||
.davonGenetikproben)),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft, child: TextField()),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
height: 40,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.anzahlOestrusblut)),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft, child: TextField()),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(AppLocalizations.of(context)!
|
||||
.davonGenetikproben)),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft, child: TextField()),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
height: 40,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.anzahlHaarproben)),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft, child: TextField()),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(AppLocalizations.of(context)!
|
||||
.davonGenetikproben)),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft, child: TextField()),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
107
lib/screens/excursion/widgets/bima_nutzer.dart
Normal file
107
lib/screens/excursion/widgets/bima_nutzer.dart
Normal file
@@ -0,0 +1,107 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
// Bundeswehr
|
||||
// Gastreitkraefte
|
||||
// NNE Bund
|
||||
// Geschaeftsliegenschaft/AGV
|
||||
// kein
|
||||
|
||||
class BimaNutzer extends StatefulWidget {
|
||||
final Function(String) onBimaNutzerChanged;
|
||||
final String initialStatus;
|
||||
|
||||
const BimaNutzer(
|
||||
{super.key, required this.onBimaNutzerChanged, this.initialStatus = 'Bundeswehr'});
|
||||
|
||||
@override
|
||||
State<BimaNutzer> createState() => _StatusState();
|
||||
}
|
||||
|
||||
class _StatusState extends State<BimaNutzer> {
|
||||
String? _selectedStatus;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_selectedStatus = widget.initialStatus;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
ListTile(
|
||||
visualDensity: const VisualDensity(vertical: -4),
|
||||
title: Text(AppLocalizations.of(context)!.bundeswehr),
|
||||
leading: Radio<String>(
|
||||
value: 'Bundeswehr',
|
||||
groupValue: _selectedStatus,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_selectedStatus = value;
|
||||
widget.onBimaNutzerChanged(value!);
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
visualDensity: const VisualDensity(vertical: -4),
|
||||
title: Text(AppLocalizations.of(context)!.gaststreitkraefte),
|
||||
leading: Radio<String>(
|
||||
value: 'Gaststreitkraefte',
|
||||
groupValue: _selectedStatus,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_selectedStatus = value;
|
||||
widget.onBimaNutzerChanged(value!);
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
visualDensity: const VisualDensity(vertical: -4),
|
||||
title: Text(AppLocalizations.of(context)!.nneBund),
|
||||
leading: Radio<String>(
|
||||
value: 'NNE-Bund',
|
||||
groupValue: _selectedStatus,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_selectedStatus = value;
|
||||
widget.onBimaNutzerChanged(value!);
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
visualDensity: const VisualDensity(vertical: -4),
|
||||
title: Text(AppLocalizations.of(context)!.geschaeftsliegenschaftAGV),
|
||||
leading: Radio<String>(
|
||||
value: 'Geschaeftsliegenschaft/AGV',
|
||||
groupValue: _selectedStatus,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_selectedStatus = value;
|
||||
widget.onBimaNutzerChanged(value!);
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
visualDensity: const VisualDensity(vertical: -4),
|
||||
title: Text(AppLocalizations.of(context)!.kein),
|
||||
leading: Radio<String>(
|
||||
value: 'kein',
|
||||
groupValue: _selectedStatus,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_selectedStatus = value;
|
||||
widget.onBimaNutzerChanged(value!);
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
113
lib/screens/excursion/widgets/hinweise.dart
Normal file
113
lib/screens/excursion/widgets/hinweise.dart
Normal file
@@ -0,0 +1,113 @@
|
||||
import 'package:fforte/enums/databases.dart';
|
||||
import 'package:fforte/screens/sharedWidgets/var_text_field.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
class Hinweise extends StatefulWidget {
|
||||
final TextEditingController hinweise;
|
||||
|
||||
const Hinweise({super.key, required this.hinweise});
|
||||
|
||||
@override
|
||||
State<Hinweise> createState() => _HinweiseState();
|
||||
}
|
||||
|
||||
class _HinweiseState extends State<Hinweise> {
|
||||
// Vars for Checkboxes
|
||||
bool liegestelleChecked = false;
|
||||
bool kadaverChecked = false;
|
||||
bool sichtungChecked = false;
|
||||
bool heulenChecked = false;
|
||||
bool sonstigesChecked = false;
|
||||
|
||||
// for sonstiges textfield
|
||||
TextEditingController sonstigesController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
sonstigesController.addListener(updateController);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
sonstigesController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void updateController() {
|
||||
Map<String, bool> props = {
|
||||
"liegestelle": liegestelleChecked,
|
||||
"kadaver": kadaverChecked,
|
||||
"sichtung": sichtungChecked,
|
||||
"heulen": heulenChecked,
|
||||
"sonstiges": sonstigesChecked
|
||||
};
|
||||
bool firstRun = true;
|
||||
|
||||
widget.hinweise.text = "";
|
||||
|
||||
for (String key in props.keys) {
|
||||
if (!firstRun) {
|
||||
widget.hinweise.text += ";";
|
||||
}
|
||||
if (key == "sonstiges") {
|
||||
widget.hinweise.text += "$key:${sonstigesController.text}";
|
||||
} else {
|
||||
widget.hinweise.text += "$key:${props[key]}";
|
||||
}
|
||||
|
||||
firstRun = false;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
CheckboxListTile(
|
||||
title: Text(AppLocalizations.of(context)!.liegestelle),
|
||||
value: liegestelleChecked,
|
||||
onChanged: (bool? value) {
|
||||
setState(() => liegestelleChecked = value ?? false);
|
||||
updateController();
|
||||
}),
|
||||
CheckboxListTile(
|
||||
title: Text(AppLocalizations.of(context)!.wildtierKadaver),
|
||||
value: kadaverChecked,
|
||||
onChanged: (bool? value) {
|
||||
setState(() => kadaverChecked = value ?? false);
|
||||
updateController();
|
||||
}),
|
||||
CheckboxListTile(
|
||||
title: Text(AppLocalizations.of(context)!.sichtung),
|
||||
value: sichtungChecked,
|
||||
onChanged: (bool? value) {
|
||||
setState(() => sichtungChecked = value ?? false);
|
||||
updateController();
|
||||
}),
|
||||
CheckboxListTile(
|
||||
title: Text(AppLocalizations.of(context)!.heulen),
|
||||
value: heulenChecked,
|
||||
onChanged: (bool? value) {
|
||||
setState(() => heulenChecked = value ?? false);
|
||||
updateController();
|
||||
}),
|
||||
CheckboxListTile(
|
||||
title: Text(AppLocalizations.of(context)!.sonstiges),
|
||||
value: sonstigesChecked,
|
||||
onChanged: (bool? value) {
|
||||
setState(() => sonstigesChecked = value ?? false);
|
||||
updateController();
|
||||
}),
|
||||
if (sonstigesChecked)
|
||||
VarTextField(
|
||||
textController: sonstigesController,
|
||||
localization: AppLocalizations.of(context)!.sonstiges,
|
||||
dbName: "HinweiseSonstiges",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
103
lib/screens/excursion/widgets/hund_u_leine.dart
Normal file
103
lib/screens/excursion/widgets/hund_u_leine.dart
Normal file
@@ -0,0 +1,103 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
class HundULeine extends StatefulWidget {
|
||||
// 1. with dog (ja, bzw name oder nein) 2. with leash
|
||||
// if nothing selected null
|
||||
final Function(String, String) onMHundChanged;
|
||||
|
||||
const HundULeine({super.key, required this.onMHundChanged});
|
||||
|
||||
@override
|
||||
HundULeineState createState() => HundULeineState();
|
||||
}
|
||||
|
||||
class HundULeineState extends State<HundULeine> {
|
||||
String? _selectedMHundValue;
|
||||
String _selectedMLeineValue = "nein";
|
||||
TextEditingController controller = TextEditingController();
|
||||
bool visible = false;
|
||||
|
||||
void onValueChanged(String mHund, String mLeine) {
|
||||
setState(() {
|
||||
visible = mHund == "ja" ? true : false;
|
||||
_selectedMHundValue = mHund;
|
||||
_selectedMLeineValue = mLeine;
|
||||
});
|
||||
|
||||
if (mHund != "nein" && controller.text != "") mHund = controller.text;
|
||||
|
||||
if (mHund == "nein") {
|
||||
_selectedMHundValue = "nein";
|
||||
widget.onMHundChanged(mHund, "nein");
|
||||
} else {
|
||||
widget.onMHundChanged(mHund, mLeine);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(AppLocalizations.of(context)!.mHund)),
|
||||
ListTile(
|
||||
visualDensity: const VisualDensity(vertical: -4),
|
||||
title: Text(AppLocalizations.of(context)!.ja),
|
||||
leading: Radio<String>(
|
||||
value: "ja",
|
||||
groupValue: _selectedMHundValue,
|
||||
onChanged: (value) {
|
||||
onValueChanged(value!, _selectedMLeineValue);
|
||||
},
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
visualDensity: const VisualDensity(vertical: -4),
|
||||
title: Text(AppLocalizations.of(context)!.nein),
|
||||
leading: Radio<String>(
|
||||
value: "nein",
|
||||
groupValue: _selectedMHundValue,
|
||||
onChanged: (value) {
|
||||
onValueChanged(value!, _selectedMLeineValue);
|
||||
},
|
||||
),
|
||||
),
|
||||
if (visible) ...[
|
||||
TextField(
|
||||
controller: controller,
|
||||
onChanged: (value) {
|
||||
onValueChanged("ja", _selectedMLeineValue);
|
||||
},
|
||||
decoration:
|
||||
InputDecoration(hintText: AppLocalizations.of(context)!.name),
|
||||
),
|
||||
Text(AppLocalizations.of(context)!.mLeine),
|
||||
ListTile(
|
||||
visualDensity: const VisualDensity(vertical: -4),
|
||||
title: Text(AppLocalizations.of(context)!.ja),
|
||||
leading: Radio<String>(
|
||||
value: "ja",
|
||||
groupValue: _selectedMLeineValue,
|
||||
onChanged: (value) {
|
||||
onValueChanged("ja", value!);
|
||||
},
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
visualDensity: const VisualDensity(vertical: -4),
|
||||
title: Text(AppLocalizations.of(context)!.nein),
|
||||
leading: Radio<String>(
|
||||
value: "nein",
|
||||
groupValue: _selectedMLeineValue,
|
||||
onChanged: (value) {
|
||||
onValueChanged("ja", value!);
|
||||
},
|
||||
),
|
||||
),
|
||||
]
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
58
lib/screens/excursion/widgets/letzter_niederschlag.dart
Normal file
58
lib/screens/excursion/widgets/letzter_niederschlag.dart
Normal file
@@ -0,0 +1,58 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
class LetzterNiederschlag extends StatefulWidget {
|
||||
final TextEditingController controller;
|
||||
|
||||
const LetzterNiederschlag({super.key, required this.controller});
|
||||
|
||||
@override
|
||||
LetzterNiederschlagState createState() => LetzterNiederschlagState();
|
||||
}
|
||||
|
||||
class LetzterNiederschlagState extends State<LetzterNiederschlag> {
|
||||
String? selectedValue; // Variable für den ausgewählten Wert
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DropdownButton<String>(
|
||||
isExpanded: true,
|
||||
value: selectedValue,
|
||||
hint: Text(AppLocalizations.of(context)!.letzterNiederschlag),
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
selectedValue = newValue; // Aktualisiere den ausgewählten Wert
|
||||
});
|
||||
},
|
||||
items: [
|
||||
DropdownMenuItem<String>(
|
||||
value: "aktuell",
|
||||
child: Text(AppLocalizations.of(context)!.aktuell),
|
||||
),
|
||||
DropdownMenuItem<String>(
|
||||
value: "selberMorgen",
|
||||
child: Text(AppLocalizations.of(context)!.selberMorgen),
|
||||
),
|
||||
DropdownMenuItem<String>(
|
||||
value: "nacht",
|
||||
child: Text(AppLocalizations.of(context)!.letzteNacht),
|
||||
),
|
||||
DropdownMenuItem<String>(
|
||||
value: "vortag",
|
||||
child: Text(AppLocalizations.of(context)!.vortag),
|
||||
),
|
||||
DropdownMenuItem<String>(
|
||||
value: "vor23Tagen",
|
||||
child: Text(AppLocalizations.of(context)!.vor23Tagen),
|
||||
),
|
||||
DropdownMenuItem<String>(
|
||||
value: "vor46Tagen",
|
||||
child: Text(AppLocalizations.of(context)!.vor46Tagen),
|
||||
),
|
||||
DropdownMenuItem<String>(
|
||||
value: "vor1Woche",
|
||||
child: Text(AppLocalizations.of(context)!.vor1Woche),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
142
lib/screens/excursion/widgets/spur_gefunden.dart
Normal file
142
lib/screens/excursion/widgets/spur_gefunden.dart
Normal file
@@ -0,0 +1,142 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
class SpurGefunden extends StatefulWidget {
|
||||
final TextEditingController spurFund;
|
||||
final TextEditingController spurLang;
|
||||
final TextEditingController spurTiere;
|
||||
final TextEditingController spSicher;
|
||||
final TextEditingController welpenSp;
|
||||
final TextEditingController welpenAnz;
|
||||
final TextEditingController wpSicher;
|
||||
|
||||
const SpurGefunden(
|
||||
{super.key,
|
||||
required this.spurFund,
|
||||
required this.spurLang,
|
||||
required this.spurTiere,
|
||||
required this.spSicher,
|
||||
required this.welpenSp,
|
||||
required this.welpenAnz,
|
||||
required this.wpSicher});
|
||||
|
||||
@override
|
||||
State<SpurGefunden> createState() => _SpurGefundenState();
|
||||
}
|
||||
|
||||
class _SpurGefundenState extends State<SpurGefunden> {
|
||||
bool _spurFundChecked = false;
|
||||
bool _spSicher = false;
|
||||
bool _wpSicher = false;
|
||||
bool _welpenSp = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(AppLocalizations.of(context)!.spurGefunden),
|
||||
Checkbox(
|
||||
value: _spurFundChecked,
|
||||
onChanged: (val) {
|
||||
setState(() {
|
||||
_spurFundChecked = val ?? false;
|
||||
widget.spurFund.text = val ?? false ? "Spur" : "";
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
Visibility(
|
||||
visible: _spurFundChecked,
|
||||
child: Column(
|
||||
children: [
|
||||
Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(AppLocalizations.of(context)!.gesLaengeAllerDokSpuren)),
|
||||
TextField(
|
||||
keyboardType: TextInputType.number,
|
||||
controller: widget.spurLang,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(AppLocalizations.of(context)!.maxAnzahlZusGefaehrdeterTiere)),
|
||||
TextField(
|
||||
keyboardType: TextInputType.number,
|
||||
controller: widget.spurTiere,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Text(AppLocalizations.of(context)!.sicher),
|
||||
Checkbox(
|
||||
value: _spSicher,
|
||||
onChanged: (val) {
|
||||
setState(() {
|
||||
_spSicher = val ?? false;
|
||||
widget.spSicher.text = _spSicher ? "sicher" : "unsicher";
|
||||
});
|
||||
}),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Text(AppLocalizations.of(context)!.welpenSpurGefunden),
|
||||
Checkbox(
|
||||
value: _welpenSp,
|
||||
onChanged: (val) {
|
||||
setState(() {
|
||||
_welpenSp = val ?? false;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
Visibility(
|
||||
visible: _welpenSp,
|
||||
child: Column(
|
||||
children: [
|
||||
Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(AppLocalizations.of(context)!.gesLaengeAllerDokSpuren)),
|
||||
TextField(
|
||||
keyboardType: TextInputType.number,
|
||||
controller: widget.welpenSp,
|
||||
),
|
||||
const SizedBox(height: 20,),
|
||||
Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(AppLocalizations.of(context)!.maxAnzahlZusGefaehrdeterTiere)),
|
||||
TextField(
|
||||
keyboardType: TextInputType.number,
|
||||
controller: widget.welpenAnz,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Text(AppLocalizations.of(context)!.sicher),
|
||||
Checkbox(
|
||||
value: _wpSicher,
|
||||
onChanged: (val) {
|
||||
setState(() {
|
||||
_wpSicher = val ?? false;
|
||||
widget.spSicher.text =
|
||||
_spSicher ? "sicher" : "unsicher";
|
||||
});
|
||||
}),
|
||||
],
|
||||
),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
220
lib/screens/excursion/widgets/strecke_u_spurbedingungen.dart
Normal file
220
lib/screens/excursion/widgets/strecke_u_spurbedingungen.dart
Normal file
@@ -0,0 +1,220 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
class StreckeUSpurbedingungen extends StatefulWidget {
|
||||
final TextEditingController kmAutoController;
|
||||
final TextEditingController kmFussController;
|
||||
final TextEditingController kmRadController;
|
||||
final TextEditingController spGutController;
|
||||
final TextEditingController spMittelController;
|
||||
final TextEditingController spSchlechtController;
|
||||
|
||||
const StreckeUSpurbedingungen(
|
||||
{required this.kmAutoController,
|
||||
required this.kmFussController,
|
||||
required this.kmRadController,
|
||||
required this.spGutController,
|
||||
required this.spMittelController,
|
||||
required this.spSchlechtController,
|
||||
super.key});
|
||||
|
||||
@override
|
||||
StreckeUSpurbedingungenState createState() => StreckeUSpurbedingungenState();
|
||||
}
|
||||
|
||||
class StreckeUSpurbedingungenState extends State<StreckeUSpurbedingungen> {
|
||||
// vars for percent text fields
|
||||
String carPercent = "0";
|
||||
String footPercent = "0";
|
||||
String bikePercent = "0";
|
||||
|
||||
String goodPercent = "0";
|
||||
String middlePercent = "0";
|
||||
String badPercent = "0";
|
||||
|
||||
String totalKm = "0";
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
// Travle Distance
|
||||
widget.kmAutoController.addListener(onDistanceTravledUpdated);
|
||||
widget.kmFussController.addListener(onDistanceTravledUpdated);
|
||||
widget.kmRadController.addListener(onDistanceTravledUpdated);
|
||||
|
||||
widget.kmAutoController.text = "0";
|
||||
widget.kmFussController.text = "0";
|
||||
widget.kmRadController.text = "0";
|
||||
|
||||
// Track Conditions
|
||||
widget.spGutController.addListener(onTrackConditionsUpdated);
|
||||
widget.spMittelController.addListener(onTrackConditionsUpdated);
|
||||
widget.spSchlechtController.addListener(onTrackConditionsUpdated);
|
||||
|
||||
widget.spGutController.text = "0";
|
||||
widget.spMittelController.text = "0";
|
||||
widget.spSchlechtController.text = "0";
|
||||
}
|
||||
|
||||
|
||||
void onDistanceTravledUpdated() {
|
||||
try {
|
||||
double kmAuto = double.parse(widget.kmAutoController.text);
|
||||
double kmFuss = double.parse(widget.kmFussController.text);
|
||||
double kmRad = double.parse(widget.kmRadController.text);
|
||||
double gesKm = (kmAuto + kmFuss + kmRad);
|
||||
|
||||
if (gesKm == 0) {
|
||||
carPercent = "0";
|
||||
footPercent = "0";
|
||||
bikePercent = "0";
|
||||
} else {
|
||||
carPercent = (kmAuto / gesKm * 100).round().toString();
|
||||
footPercent = (kmFuss / gesKm * 100).round().toString();
|
||||
bikePercent = (kmRad / gesKm * 100).round().toString();
|
||||
totalKm = gesKm.toString();
|
||||
}
|
||||
setState(() {});
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void onTrackConditionsUpdated() {
|
||||
try {
|
||||
double kmGood = double.parse(widget.spGutController.text);
|
||||
double kmMiddle = double.parse(widget.spMittelController.text);
|
||||
double kmBad = double.parse(widget.spSchlechtController.text);
|
||||
double gesKm = (kmGood + kmMiddle + kmBad);
|
||||
|
||||
if (gesKm == 0) {
|
||||
goodPercent = "0";
|
||||
middlePercent = "0";
|
||||
badPercent = "0";
|
||||
} else {
|
||||
goodPercent = (kmGood / gesKm * 100).round().toString();
|
||||
middlePercent = (kmMiddle / gesKm * 100).round().toString();
|
||||
badPercent = (kmBad / gesKm * 100).round().toString();
|
||||
}
|
||||
setState(() {});
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.zurueckgelegteStrecke,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
)),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(child: Text(AppLocalizations.of(context)!.auto)),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.number,
|
||||
controller: widget.kmAutoController,
|
||||
)),
|
||||
Expanded(child: Center(child: Text("="))),
|
||||
Expanded(child: Center(child: Text(carPercent))),
|
||||
Expanded(child: Center(child: Text("%"))),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(child: Text(AppLocalizations.of(context)!.zuFuss)),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.number,
|
||||
controller: widget.kmFussController)),
|
||||
Expanded(child: Center(child: Text("="))),
|
||||
Expanded(child: Center(child: Text(footPercent))),
|
||||
Expanded(child: Center(child: Text("%"))),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(child: Text(AppLocalizations.of(context)!.fahrrad)),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.number,
|
||||
controller: widget.kmRadController)),
|
||||
Expanded(child: Center(child: Text("="))),
|
||||
Expanded(child: Center(child: Text(bikePercent))),
|
||||
Expanded(child: Center(child: Text("%"))),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text(AppLocalizations.of(context)!.gesamt),
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(totalKm),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.spurbedingungen,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(child: Text(AppLocalizations.of(context)!.gut)),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.number,
|
||||
controller: widget.spGutController)),
|
||||
Expanded(child: Center(child: Text("="))),
|
||||
Expanded(child: Center(child: Text(goodPercent))),
|
||||
Expanded(child: Center(child: Text("%"))),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(child: Text(AppLocalizations.of(context)!.mittel)),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.number,
|
||||
controller: widget.spMittelController)),
|
||||
Expanded(child: Center(child: Text("="))),
|
||||
Expanded(child: Center(child: Text(middlePercent))),
|
||||
Expanded(child: Center(child: Text("%"))),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(child: Text(AppLocalizations.of(context)!.schlecht)),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.number,
|
||||
controller: widget.spSchlechtController,
|
||||
)),
|
||||
Expanded(child: Center(child: Text("="))),
|
||||
Expanded(child: Center(child: Text(badPercent))),
|
||||
Expanded(child: Center(child: Text("%"))),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user