120 lines
4.1 KiB
Dart
120 lines
4.1 KiB
Dart
import 'package:animations/animations.dart';
|
|
import 'package:fforte/screens/sharedWidgets/datum.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 ExcursionMain extends StatefulWidget {
|
|
const ExcursionMain({super.key});
|
|
|
|
@override
|
|
State<ExcursionMain> createState() => _ExcursionMainState();
|
|
}
|
|
|
|
class _ExcursionMainState extends State<ExcursionMain> {
|
|
// erste überlegung: map mit textcontrollern und map mit rest. maybe später schauen, dass alles in die eine map und mit instanceoff (in dart version) checken
|
|
|
|
String datum = '';
|
|
// dauer: nachfragen wie gespeichert werden soll und demnach felt machen. Vorerst eingaches Textfeld
|
|
// TODO:
|
|
// - Hund dabei u mit leine u fragen was dieses nein textfeld soll
|
|
// - Input vorgabe fuer dauer feld
|
|
|
|
Map<String, TextEditingController> getTextFields() {
|
|
Map<String, TextEditingController> rmap = {
|
|
"Rudel": TextEditingController(),
|
|
"Teilnehm": TextEditingController(),
|
|
"Jahr": TextEditingController(),
|
|
"Dauer_Stungen": TextEditingController(),
|
|
"BLand": TextEditingController(),
|
|
"Lkr": TextEditingController(),
|
|
"BeiOrt": TextEditingController(),
|
|
"BimaNr": TextEditingController(),
|
|
"BimaName": TextEditingController(),
|
|
"BimaNutzer": TextEditingController(),
|
|
"BimAGV": TextEditingController(),
|
|
|
|
};
|
|
|
|
return rmap;
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
List<Step> getSteps() => [
|
|
Step(
|
|
title: Text(AppLocalizations.of(context)!.dateandtime),
|
|
content: Column(
|
|
children: [
|
|
Datum(initDatum: DateTime.now(), onDateChanged: (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 Step(title: Text("step2"), content: Text("data"))
|
|
];
|
|
|
|
int currentStep = 0;
|
|
|
|
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,
|
|
);
|
|
},
|
|
child: Stepper(
|
|
key: ValueKey(currentStep),
|
|
steps: getSteps(),
|
|
currentStep: currentStep,
|
|
onStepTapped: (value) {
|
|
setState(() {
|
|
currentStep = value;
|
|
});
|
|
},
|
|
onStepContinue: () async {
|
|
final bool isLastStep = currentStep == getSteps().length - 1;
|
|
|
|
if (!isLastStep) {
|
|
setState(() {
|
|
currentStep += 1;
|
|
});
|
|
}
|
|
},
|
|
onStepCancel: () {
|
|
if (currentStep == 0) {
|
|
Navigator.pop(context);
|
|
} else {
|
|
setState(() {
|
|
currentStep -= 1;
|
|
});
|
|
}
|
|
},
|
|
),
|
|
));
|
|
}
|
|
}
|