finished mHund u mLeine fields
This commit is contained in:
@@ -115,5 +115,6 @@
|
||||
"geschaeftsliegenschaftAGV": "Geschäftsliegenschaft/AGV",
|
||||
"kein": "Kein",
|
||||
"mHund": "Hund dabei",
|
||||
"mLeine": "Mit Leine"
|
||||
"mLeine": "Mit Leine",
|
||||
"name": "Name"
|
||||
}
|
||||
@@ -567,9 +567,16 @@
|
||||
"mLeine": "With Dog leash",
|
||||
"@mLeine": {
|
||||
"description": "mLeine radiobutten"
|
||||
},
|
||||
|
||||
"name": "Name",
|
||||
"@name": {
|
||||
"description": "name text field"
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:animations/animations.dart';
|
||||
import 'package:fforte/screens/Excursion/widgets/bima_nutzer.dart';
|
||||
import 'package:fforte/screens/Excursion/widgets/hund_u_leine.dart';
|
||||
import 'package:fforte/screens/sharedWidgets/datum.dart';
|
||||
import 'package:fforte/screens/sharedWidgets/var_text_field.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -46,6 +47,7 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
||||
title: Text(AppLocalizations.of(context)!.dateandtime),
|
||||
content: Column(
|
||||
children: [
|
||||
// TODO onDateChanged
|
||||
Datum(initDatum: DateTime.now(), onDateChanged: (date) {}),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
@@ -62,21 +64,27 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
||||
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,
|
||||
),
|
||||
required: false,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["Dauer"]!,
|
||||
localization: AppLocalizations.of(context)!.dauer,
|
||||
dbName: "Dauer",
|
||||
required: false),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
|
||||
// Hund u Leine
|
||||
HundULeine(onMHundChanged: (mHund, mLeine) {
|
||||
getTextFields()["MHund"]!.text = mHund;
|
||||
getTextFields()["MLeine"]!.text = mLeine;
|
||||
|
||||
print(mHund);
|
||||
print(mLeine);
|
||||
}),
|
||||
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
|
||||
@@ -2,7 +2,9 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
class HundULeine extends StatefulWidget {
|
||||
final Function(String) onMHundChanged;
|
||||
// 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});
|
||||
|
||||
@@ -11,12 +13,26 @@ class HundULeine extends StatefulWidget {
|
||||
}
|
||||
|
||||
class HundULeineState extends State<HundULeine> {
|
||||
String? _selectedValue;
|
||||
String? _selectedMHundValue;
|
||||
String _selectedMLeineValue = "nein";
|
||||
TextEditingController controller = TextEditingController();
|
||||
bool visible = false;
|
||||
|
||||
void onChanged(String mHund, String name, String mLeine) {
|
||||
|
||||
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
|
||||
@@ -29,12 +45,9 @@ class HundULeineState extends State<HundULeine> {
|
||||
title: Text(AppLocalizations.of(context)!.ja),
|
||||
leading: Radio<String>(
|
||||
value: "ja",
|
||||
groupValue: _selectedValue,
|
||||
groupValue: _selectedMHundValue,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_selectedValue = value;
|
||||
visible = value == "ja" ? true : false;
|
||||
});
|
||||
onValueChanged(value!, _selectedMLeineValue);
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -43,18 +56,20 @@ class HundULeineState extends State<HundULeine> {
|
||||
title: Text(AppLocalizations.of(context)!.nein),
|
||||
leading: Radio<String>(
|
||||
value: "nein",
|
||||
groupValue: _selectedValue,
|
||||
groupValue: _selectedMHundValue,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_selectedValue = value;
|
||||
visible = value == "ja" ? true : false;
|
||||
});
|
||||
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(
|
||||
@@ -62,12 +77,9 @@ class HundULeineState extends State<HundULeine> {
|
||||
title: Text(AppLocalizations.of(context)!.ja),
|
||||
leading: Radio<String>(
|
||||
value: "ja",
|
||||
groupValue: _selectedValue,
|
||||
groupValue: _selectedMLeineValue,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_selectedValue = value;
|
||||
widget.onMHundChanged(value!);
|
||||
});
|
||||
onValueChanged("ja", value!);
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -76,12 +88,9 @@ class HundULeineState extends State<HundULeine> {
|
||||
title: Text(AppLocalizations.of(context)!.nein),
|
||||
leading: Radio<String>(
|
||||
value: "nein",
|
||||
groupValue: _selectedValue,
|
||||
groupValue: _selectedMLeineValue,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_selectedValue = value;
|
||||
widget.onMHundChanged(value!);
|
||||
});
|
||||
onValueChanged("ja", value!);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user