continued hinweise widget (doesnt save the strings yet); splittet up databases
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:animations/animations.dart';
|
||||
import 'package:fforte/enums/databases.dart';
|
||||
import 'package:fforte/screens/Excursion/widgets/anzahlen.dart';
|
||||
import 'package:fforte/screens/Excursion/widgets/bima_nutzer.dart';
|
||||
import 'package:fforte/screens/Excursion/widgets/hinweise.dart';
|
||||
@@ -23,64 +24,64 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
||||
|
||||
Map<String, TextEditingController> getTextFields() {
|
||||
Map<String, TextEditingController> rmap = {
|
||||
// Step 1
|
||||
"LogDat": TextEditingController(),
|
||||
"Rudel": TextEditingController(),
|
||||
"Teilnehm": TextEditingController(),
|
||||
"Jahr": TextEditingController(),
|
||||
"Dauer": TextEditingController(),
|
||||
"MHund": TextEditingController(),
|
||||
"MLeine": TextEditingController(),
|
||||
"BLand": TextEditingController(),
|
||||
"Lkr": TextEditingController(),
|
||||
"BeiOrt": TextEditingController(),
|
||||
"BimaNr": TextEditingController(),
|
||||
"BimaName": TextEditingController(),
|
||||
"BimaNutzer": TextEditingController(),
|
||||
"BimaAGV": TextEditingController(),
|
||||
// Step 1
|
||||
"LogDat": TextEditingController(),
|
||||
"Rudel": TextEditingController(),
|
||||
"Teilnehm": TextEditingController(),
|
||||
"Jahr": TextEditingController(),
|
||||
"Dauer": TextEditingController(),
|
||||
"MHund": TextEditingController(),
|
||||
"MLeine": TextEditingController(),
|
||||
"BLand": TextEditingController(),
|
||||
"Lkr": TextEditingController(),
|
||||
"BeiOrt": TextEditingController(),
|
||||
"BimaNr": TextEditingController(),
|
||||
"BimaName": TextEditingController(),
|
||||
"BimaNutzer": TextEditingController(),
|
||||
"BimaAGV": TextEditingController(),
|
||||
|
||||
// Step 2
|
||||
"Wetter": TextEditingController(),
|
||||
"Temperat": TextEditingController(),
|
||||
"RegenVor": TextEditingController(),
|
||||
"KmAuto": TextEditingController(),
|
||||
"KmFuss": TextEditingController(),
|
||||
"KmRad": TextEditingController(),
|
||||
"KmTotal": TextEditingController(),
|
||||
"KmAuProz": TextEditingController(),
|
||||
"KmFuProz": TextEditingController(),
|
||||
"KmRaProz": TextEditingController(),
|
||||
// Step 2
|
||||
"Wetter": TextEditingController(),
|
||||
"Temperat": TextEditingController(),
|
||||
"RegenVor": TextEditingController(),
|
||||
"KmAuto": TextEditingController(),
|
||||
"KmFuss": TextEditingController(),
|
||||
"KmRad": TextEditingController(),
|
||||
"KmTotal": TextEditingController(),
|
||||
"KmAuProz": TextEditingController(),
|
||||
"KmFuProz": TextEditingController(),
|
||||
"KmRaProz": TextEditingController(),
|
||||
|
||||
// Spur maybe own step?
|
||||
"SpGut": TextEditingController(),
|
||||
"SpMittel": TextEditingController(),
|
||||
"SpSchlecht": TextEditingController(),
|
||||
"SpurFund": TextEditingController(),
|
||||
"SpurLang": TextEditingController(),
|
||||
"SpurTiere": TextEditingController(),
|
||||
"SpSicher": TextEditingController(),
|
||||
"WelpenSp": TextEditingController(),
|
||||
"WelpenAnz": TextEditingController(),
|
||||
"WpSicher": TextEditingController(),
|
||||
// Spur maybe own step?
|
||||
"SpGut": TextEditingController(),
|
||||
"SpMittel": TextEditingController(),
|
||||
"SpSchlecht": TextEditingController(),
|
||||
"SpurFund": TextEditingController(),
|
||||
"SpurLang": TextEditingController(),
|
||||
"SpurTiere": TextEditingController(),
|
||||
"SpSicher": TextEditingController(),
|
||||
"WelpenSp": TextEditingController(),
|
||||
"WelpenAnz": TextEditingController(),
|
||||
"WpSicher": TextEditingController(),
|
||||
|
||||
"LosungGes": TextEditingController(),
|
||||
"LosungAnz": TextEditingController(),
|
||||
"LosungGen": TextEditingController(),
|
||||
"UrinAnz": TextEditingController(),
|
||||
"UrinGen": TextEditingController(),
|
||||
"OestrAnz": TextEditingController(),
|
||||
"OestrGen": TextEditingController(),
|
||||
"HaarAnz": TextEditingController(),
|
||||
"HaarGen": TextEditingController(),
|
||||
"LosungKm": TextEditingController(),
|
||||
"GenetiKm": TextEditingController(),
|
||||
"Hinweise": TextEditingController(),
|
||||
"LosungGes": TextEditingController(),
|
||||
"LosungAnz": TextEditingController(),
|
||||
"LosungGen": TextEditingController(),
|
||||
"UrinAnz": TextEditingController(),
|
||||
"UrinGen": TextEditingController(),
|
||||
"OestrAnz": TextEditingController(),
|
||||
"OestrGen": TextEditingController(),
|
||||
"HaarAnz": TextEditingController(),
|
||||
"HaarGen": TextEditingController(),
|
||||
"LosungKm": TextEditingController(),
|
||||
"GenetiKm": TextEditingController(),
|
||||
"Hinweise": TextEditingController(),
|
||||
|
||||
// Step 3
|
||||
"Bemerk": TextEditingController(),
|
||||
"IntKomm": TextEditingController(),
|
||||
"FallNum": TextEditingController(),
|
||||
};
|
||||
// Step 3
|
||||
"Bemerk": TextEditingController(),
|
||||
"IntKomm": TextEditingController(),
|
||||
"FallNum": TextEditingController(),
|
||||
};
|
||||
|
||||
return rmap;
|
||||
}
|
||||
@@ -90,235 +91,265 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<Step> getSteps() => [
|
||||
Step(
|
||||
title: Text(AppLocalizations.of(context)!.dateandtime),
|
||||
content: Column(
|
||||
children: [
|
||||
Datum(
|
||||
initDatum: DateTime.now(),
|
||||
onDateChanged: (date) {
|
||||
getTextFields()["LogDat"]!.text = date.toString();
|
||||
},
|
||||
name: AppLocalizations.of(context)!.date,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["Rudel"]!,
|
||||
localization: AppLocalizations.of(context)!.rudel,
|
||||
dbName: "Rudel",
|
||||
required: false),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["Teilnehm"]!,
|
||||
localization: AppLocalizations.of(context)!.teilnehmer,
|
||||
dbName: "Teilnehm",
|
||||
required: false,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["Dauer"]!,
|
||||
localization: AppLocalizations.of(context)!.dauer,
|
||||
dbName: "Dauer",
|
||||
required: false),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
HundULeine(onMHundChanged: (mHund, mLeine) {
|
||||
getTextFields()["MHund"]!.text = mHund;
|
||||
getTextFields()["MLeine"]!.text = mLeine;
|
||||
|
||||
// print(mHund);
|
||||
// print(mLeine);
|
||||
}),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["BLand"]!,
|
||||
localization: AppLocalizations.of(context)!.bland,
|
||||
dbName: "BLand",
|
||||
required: false),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["Lkr"]!,
|
||||
localization: AppLocalizations.of(context)!.lkr,
|
||||
dbName: "Lkr",
|
||||
required: false),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["BeiOrt"]!,
|
||||
localization: AppLocalizations.of(context)!.beiort,
|
||||
dbName: "BeiOrt",
|
||||
required: false),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
const Divider(),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["BimaNr"]!,
|
||||
localization: AppLocalizations.of(context)!.bimaNr,
|
||||
dbName: "BimaNr",
|
||||
required: false),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["BimaName"]!,
|
||||
localization: AppLocalizations.of(context)!.bimaName,
|
||||
dbName: "BimaName",
|
||||
required: false),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
BimaNutzer(onBimaNutzerChanged: (value) {
|
||||
setState(() {
|
||||
getTextFields()["BimaNutzer"]!.text = value;
|
||||
});
|
||||
}),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["BimaAGV"]!,
|
||||
localization: AppLocalizations.of(context)!.bimaAGV,
|
||||
dbName: "BimaAGV",
|
||||
required: false)
|
||||
],
|
||||
)),
|
||||
Step(
|
||||
title: const Text("step2"),
|
||||
content: Column(
|
||||
children: [
|
||||
VarTextField(
|
||||
textController: getTextFields()["Wetter"]!,
|
||||
localization: "Wetter",
|
||||
dbName: "Wetter",
|
||||
required: false),
|
||||
const SizedBox(height: 10),
|
||||
VarTextField(
|
||||
textController: getTextFields()["Temperat"]!,
|
||||
localization: "Temperatur",
|
||||
dbName: "Temperat",
|
||||
required: false),
|
||||
const SizedBox(height: 10),
|
||||
LetzterNiederschlag(controller: getTextFields()["RegenVor"]!),
|
||||
const SizedBox(height: 20),
|
||||
StreckeUSpurbedingungen(
|
||||
kmAutoController: getTextFields()["KmAuto"]!,
|
||||
kmFussController: getTextFields()["KmFuss"]!,
|
||||
kmRadController: getTextFields()["KmRad"]!,
|
||||
spGutController: getTextFields()["SpGut"]!,
|
||||
spMittelController: getTextFields()["SpMittel"]!,
|
||||
spSchlechtController: getTextFields()["SpSchlecht"]!,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
const Divider(),
|
||||
SpurGefunden(
|
||||
spurFund: getTextFields()["SpurFund"]!,
|
||||
spurLang: getTextFields()["SpurLang"]!,
|
||||
spurTiere: getTextFields()["SpurTiere"]!,
|
||||
spSicher: getTextFields()["SpSicher"]!,
|
||||
welpenSp: getTextFields()["WelpenSp"]!,
|
||||
welpenAnz: getTextFields()["WelpenAnz"]!,
|
||||
wpSicher: getTextFields()["WpSicher"]!),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Anzahlen(
|
||||
losungAnz: getTextFields()["LosungAnz"]!,
|
||||
losungGes: getTextFields()["LosungGes"]!,
|
||||
losungGen: getTextFields()["LosungGen"]!,
|
||||
urinAnz: getTextFields()["UrinAnz"]!,
|
||||
urinGen: getTextFields()["UrinGen"]!,
|
||||
oestrAnz: getTextFields()["OestrAnz"]!,
|
||||
oestrGen: getTextFields()["OestrGen"]!,
|
||||
haarAnz: getTextFields()["HaarAnz"]!,
|
||||
haarGen: getTextFields()["HaarGen"]!,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Hinweise(),
|
||||
],
|
||||
Step(
|
||||
title: Text(AppLocalizations.of(context)!.dateandtime),
|
||||
content: Column(
|
||||
children: [
|
||||
Datum(
|
||||
initDatum: DateTime.now(),
|
||||
onDateChanged: (date) {
|
||||
getTextFields()["LogDat"]!.text = date.toString();
|
||||
},
|
||||
name: AppLocalizations.of(context)!.date,
|
||||
),
|
||||
),
|
||||
|
||||
Step(
|
||||
title: const Text("step3"),
|
||||
content: Column(
|
||||
children: [
|
||||
VarTextField(textController: getTextFields()["Bemerk"]!,
|
||||
localization: "Bemerkungen",
|
||||
dbName: "Bemerk",
|
||||
required: false),
|
||||
|
||||
const SizedBox(height: 20,),
|
||||
VarTextField(textController: getTextFields()["IntKomm"]!,
|
||||
localization: "Interne Kommunikation",
|
||||
dbName: "IntKomm", required: false),
|
||||
],
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
),
|
||||
];
|
||||
VarTextField(
|
||||
textController: getTextFields()["Rudel"]!,
|
||||
localization: AppLocalizations.of(context)!.rudel,
|
||||
dbName: "Rudel",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["Teilnehm"]!,
|
||||
localization: AppLocalizations.of(context)!.teilnehmer,
|
||||
dbName: "Teilnehm",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["Dauer"]!,
|
||||
localization: AppLocalizations.of(context)!.dauer,
|
||||
dbName: "Dauer",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
HundULeine(onMHundChanged: (mHund, mLeine) {
|
||||
getTextFields()["MHund"]!.text = mHund;
|
||||
getTextFields()["MLeine"]!.text = mLeine;
|
||||
|
||||
// print(mHund);
|
||||
// print(mLeine);
|
||||
}),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["BLand"]!,
|
||||
localization: AppLocalizations.of(context)!.bland,
|
||||
dbName: "BLand",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["Lkr"]!,
|
||||
localization: AppLocalizations.of(context)!.lkr,
|
||||
dbName: "Lkr",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["BeiOrt"]!,
|
||||
localization: AppLocalizations.of(context)!.beiort,
|
||||
dbName: "BeiOrt",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
const Divider(),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["BimaNr"]!,
|
||||
localization: AppLocalizations.of(context)!.bimaNr,
|
||||
dbName: "BimaNr",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["BimaName"]!,
|
||||
localization: AppLocalizations.of(context)!.bimaName,
|
||||
dbName: "BimaName",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
BimaNutzer(onBimaNutzerChanged: (value) {
|
||||
setState(() {
|
||||
getTextFields()["BimaNutzer"]!.text = value;
|
||||
});
|
||||
}),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["BimaAGV"]!,
|
||||
localization: AppLocalizations.of(context)!.bimaAGV,
|
||||
dbName: "BimaAGV",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
)
|
||||
],
|
||||
)),
|
||||
Step(
|
||||
title: const Text("step2"),
|
||||
content: Column(
|
||||
children: [
|
||||
VarTextField(
|
||||
textController: getTextFields()["Wetter"]!,
|
||||
localization: "Wetter",
|
||||
dbName: "Wetter",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
VarTextField(
|
||||
textController: getTextFields()["Temperat"]!,
|
||||
localization: "Temperatur",
|
||||
dbName: "Temperat",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
LetzterNiederschlag(controller: getTextFields()["RegenVor"]!),
|
||||
const SizedBox(height: 20),
|
||||
StreckeUSpurbedingungen(
|
||||
kmAutoController: getTextFields()["KmAuto"]!,
|
||||
kmFussController: getTextFields()["KmFuss"]!,
|
||||
kmRadController: getTextFields()["KmRad"]!,
|
||||
spGutController: getTextFields()["SpGut"]!,
|
||||
spMittelController: getTextFields()["SpMittel"]!,
|
||||
spSchlechtController: getTextFields()["SpSchlecht"]!,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
const Divider(),
|
||||
SpurGefunden(
|
||||
spurFund: getTextFields()["SpurFund"]!,
|
||||
spurLang: getTextFields()["SpurLang"]!,
|
||||
spurTiere: getTextFields()["SpurTiere"]!,
|
||||
spSicher: getTextFields()["SpSicher"]!,
|
||||
welpenSp: getTextFields()["WelpenSp"]!,
|
||||
welpenAnz: getTextFields()["WelpenAnz"]!,
|
||||
wpSicher: getTextFields()["WpSicher"]!),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Anzahlen(
|
||||
losungAnz: getTextFields()["LosungAnz"]!,
|
||||
losungGes: getTextFields()["LosungGes"]!,
|
||||
losungGen: getTextFields()["LosungGen"]!,
|
||||
urinAnz: getTextFields()["UrinAnz"]!,
|
||||
urinGen: getTextFields()["UrinGen"]!,
|
||||
oestrAnz: getTextFields()["OestrAnz"]!,
|
||||
oestrGen: getTextFields()["OestrGen"]!,
|
||||
haarAnz: getTextFields()["HaarAnz"]!,
|
||||
haarGen: getTextFields()["HaarGen"]!,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
const Divider(),
|
||||
Hinweise(
|
||||
hinweise: getTextFields()["Hinweise"]!,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Step(
|
||||
title: const Text("step3"),
|
||||
content: Column(
|
||||
children: [
|
||||
VarTextField(textController: getTextFields()["Bemerk"]!,
|
||||
localization: "Bemerkungen",
|
||||
dbName: "Bemerk",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
|
||||
const SizedBox(height: 20,),
|
||||
VarTextField(
|
||||
textController: getTextFields()["IntKomm"]!,
|
||||
localization: "Interne Kommunikation",
|
||||
dbName: "IntKomm",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
];
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(AppLocalizations.of(context)!.excursion),
|
||||
),
|
||||
body: PageTransitionSwitcher(
|
||||
duration: const Duration(microseconds: 800),
|
||||
transitionBuilder: (Widget child, Animation<double> animation,
|
||||
Animation<double> secondaryAnimation) {
|
||||
return SharedAxisTransition(
|
||||
animation: animation,
|
||||
secondaryAnimation: secondaryAnimation,
|
||||
transitionType: SharedAxisTransitionType.vertical,
|
||||
child: child,
|
||||
);
|
||||
appBar: AppBar(
|
||||
title: Text(AppLocalizations.of(context)!.excursion),
|
||||
),
|
||||
body: PageTransitionSwitcher(
|
||||
duration: const Duration(microseconds: 800),
|
||||
transitionBuilder: (Widget child, Animation<double> animation,
|
||||
Animation<double> secondaryAnimation) {
|
||||
return SharedAxisTransition(
|
||||
animation: animation,
|
||||
secondaryAnimation: secondaryAnimation,
|
||||
transitionType: SharedAxisTransitionType.vertical,
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
child: Stepper(
|
||||
key: ValueKey<int>(currentStep),
|
||||
steps: getSteps(),
|
||||
currentStep: currentStep,
|
||||
onStepTapped: (value) {
|
||||
setState(() {
|
||||
currentStep = value;
|
||||
});
|
||||
},
|
||||
child: Stepper(
|
||||
key: ValueKey<int>(currentStep),
|
||||
steps: getSteps(),
|
||||
currentStep: currentStep,
|
||||
onStepTapped: (value) {
|
||||
setState(() {
|
||||
currentStep = value;
|
||||
});
|
||||
},
|
||||
onStepContinue: () {
|
||||
final isLastStep = currentStep == getSteps().length - 1;
|
||||
onStepContinue: () {
|
||||
final isLastStep = currentStep == getSteps().length - 1;
|
||||
|
||||
if (!isLastStep) {
|
||||
if (!isLastStep) {
|
||||
setState(() {
|
||||
currentStep += 1;
|
||||
});
|
||||
}
|
||||
},
|
||||
onStepCancel: () {
|
||||
if (currentStep == 0) {
|
||||
},
|
||||
onStepCancel: () {
|
||||
if (currentStep == 0) {
|
||||
Navigator.pop(context);
|
||||
} else {
|
||||
setState(() {
|
||||
currentStep -= 1;
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
));
|
||||
},
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,76 @@
|
||||
import 'package:fforte/enums/databases.dart';
|
||||
import 'package:fforte/screens/sharedWidgets/var_text_field.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class Hinweise extends StatefulWidget {
|
||||
const Hinweise({super.key});
|
||||
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
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: 30,
|
||||
child: const Placeholder());
|
||||
return
|
||||
Column(
|
||||
children: [
|
||||
CheckboxListTile(
|
||||
title: Text("Liegestelle"),
|
||||
value: liegestelleChecked,
|
||||
onChanged: (bool? value) {
|
||||
setState(() => liegestelleChecked = value ?? false);
|
||||
}
|
||||
),
|
||||
|
||||
CheckboxListTile(
|
||||
title: Text("Wildtierkadaver"),
|
||||
value: kadaverChecked,
|
||||
onChanged: (bool? value) {
|
||||
setState(() => kadaverChecked = value ?? false);
|
||||
}
|
||||
),
|
||||
|
||||
CheckboxListTile(
|
||||
title: Text("Sichtung"),
|
||||
value: sichtungChecked,
|
||||
onChanged: (bool? value) {
|
||||
setState(() => sichtungChecked = value ?? false);
|
||||
}
|
||||
),
|
||||
|
||||
CheckboxListTile(
|
||||
title: Text("Heulen"),
|
||||
value: heulenChecked,
|
||||
onChanged: (bool? value) {
|
||||
setState(() => heulenChecked = value ?? false);
|
||||
}
|
||||
),
|
||||
CheckboxListTile(
|
||||
title: Text("Sonstiges"),
|
||||
value: liegestelleChecked,
|
||||
onChanged: (bool? value) {
|
||||
setState(() => sonstigesChecked = value ?? false);
|
||||
}
|
||||
),
|
||||
|
||||
if (sonstigesChecked)
|
||||
VarTextField(textController: sonstigesController, localization: "Sonstiges", dbName: "HinweiseSonstiges", required: false, dbDesignation: DatabasesEnum.excursion,)
|
||||
],
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,6 @@
|
||||
import 'package:fforte/methods/db_helper.dart';
|
||||
import 'package:fforte/enums/databases.dart';
|
||||
import 'package:fforte/methods/excursion_db_helper.dart';
|
||||
import 'package:fforte/methods/place_db_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
@@ -6,19 +8,21 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
class VarTextField extends StatefulWidget {
|
||||
final TextEditingController textController;
|
||||
final String localization;
|
||||
final DatabasesEnum dbDesignation;
|
||||
final String dbName;
|
||||
final String? defaultValue;
|
||||
final String? otherDefault;
|
||||
final bool required;
|
||||
|
||||
const VarTextField(
|
||||
{super.key,
|
||||
required this.textController,
|
||||
required this.localization,
|
||||
required this.dbName,
|
||||
required this.required,
|
||||
this.defaultValue,
|
||||
this.otherDefault});
|
||||
{super.key,
|
||||
required this.textController,
|
||||
required this.localization,
|
||||
required this.dbName,
|
||||
required this.required,
|
||||
required this.dbDesignation,
|
||||
this.defaultValue,
|
||||
this.otherDefault});
|
||||
|
||||
@override
|
||||
State<VarTextField> createState() => _VarTextFieldState();
|
||||
@@ -43,9 +47,15 @@ class _VarTextFieldState extends State<VarTextField> {
|
||||
}
|
||||
|
||||
Future<List<Map<String, dynamic>>> _loadData() async {
|
||||
var places = await DBHelper().getPlace();
|
||||
var templates = await DBHelper().getTemplates();
|
||||
return [...places, ...templates];
|
||||
if (widget.dbDesignation == DatabasesEnum.excursion) {
|
||||
var entries = await PlaceDBHelper().getPlace();
|
||||
var templatesEntries = await PlaceDBHelper().getTemplates();
|
||||
return [...entries, ...templatesEntries];
|
||||
} else {
|
||||
var entries = await ExcursionDBHelper().getExcursionen();
|
||||
var templatesEntries = await ExcursionDBHelper().getTemplates();
|
||||
return [...entries, ...templatesEntries];
|
||||
}
|
||||
}
|
||||
|
||||
void _loadPref() {
|
||||
@@ -63,35 +73,35 @@ class _VarTextFieldState extends State<VarTextField> {
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 5,
|
||||
child: TextField(
|
||||
controller: widget.textController,
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
widget.textController.text = value;
|
||||
});
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
hintText: widget.localization,
|
||||
enabledBorder: widget.required
|
||||
? (widget.textController.text.isEmpty
|
||||
? const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.red))
|
||||
: const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.green)))
|
||||
: const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey)),
|
||||
focusedBorder: widget.required
|
||||
? (widget.textController.text.isEmpty
|
||||
? const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.red))
|
||||
: const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.green)))
|
||||
: const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey))),
|
||||
)),
|
||||
flex: 5,
|
||||
child: TextField(
|
||||
controller: widget.textController,
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
widget.textController.text = value;
|
||||
});
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
hintText: widget.localization,
|
||||
enabledBorder: widget.required
|
||||
? (widget.textController.text.isEmpty
|
||||
? const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.red))
|
||||
: const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.green)))
|
||||
: const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey)),
|
||||
focusedBorder: widget.required
|
||||
? (widget.textController.text.isEmpty
|
||||
? const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.red))
|
||||
: const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.green)))
|
||||
: const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey))),
|
||||
)),
|
||||
const Expanded(
|
||||
child: SizedBox(
|
||||
width: 15,
|
||||
@@ -102,10 +112,10 @@ class _VarTextFieldState extends State<VarTextField> {
|
||||
child: Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: FutureBuilder<List<Map<String, dynamic>>>(
|
||||
future: dbVar,
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<List<Map<String, dynamic>>> snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
future: dbVar,
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<List<Map<String, dynamic>>> snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
// Filtern der Daten, um sicherzustellen, dass keine 'null' Werte für den Schlüssel dbName vorhanden sind
|
||||
var filteredData = snapshot.data!
|
||||
.where((item) =>
|
||||
@@ -136,8 +146,8 @@ class _VarTextFieldState extends State<VarTextField> {
|
||||
} else {
|
||||
return const CircularProgressIndicator();
|
||||
}
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:fforte/screens/addCam/add_cam_main.dart';
|
||||
import 'package:fforte/methods/db_helper.dart';
|
||||
import 'package:fforte/methods/place_db_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
@@ -24,8 +24,8 @@ class _ViewCamsState extends State<ViewCams> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
place = DBHelper().getPlace();
|
||||
templates = DBHelper().getTemplates();
|
||||
place = PlaceDBHelper().getPlace();
|
||||
templates = PlaceDBHelper().getTemplates();
|
||||
}
|
||||
|
||||
// functions to delete all entries LOCALLY
|
||||
@@ -44,10 +44,10 @@ class _ViewCamsState extends State<ViewCams> {
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
var placeDB = DBHelper();
|
||||
var placeDB = PlaceDBHelper();
|
||||
placeDB.deleteAllPlaces();
|
||||
setState(() {
|
||||
place = DBHelper().getPlace();
|
||||
place = PlaceDBHelper().getPlace();
|
||||
});
|
||||
|
||||
Navigator.of(context).pop();
|
||||
@@ -64,9 +64,9 @@ class _ViewCamsState extends State<ViewCams> {
|
||||
}
|
||||
|
||||
void delSinglePlace(int id) async {
|
||||
DBHelper().deletePlace(id.toString());
|
||||
PlaceDBHelper().deletePlace(id.toString());
|
||||
setState(() {
|
||||
place = DBHelper().getPlace();
|
||||
place = PlaceDBHelper().getPlace();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -85,10 +85,10 @@ class _ViewCamsState extends State<ViewCams> {
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
var placeDB = DBHelper();
|
||||
var placeDB = PlaceDBHelper();
|
||||
placeDB.deleteAllTemplates();
|
||||
setState(() {
|
||||
templates = DBHelper().getTemplates();
|
||||
templates = PlaceDBHelper().getTemplates();
|
||||
});
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user