This commit is contained in:
2024-04-24 17:45:49 +02:00
7 changed files with 234 additions and 86 deletions

View File

@@ -2417,6 +2417,101 @@ class _FKontakt3State extends State<FKontakt3> {
);
}
<<<<<<< HEAD
=======
// Standort
class Standort extends StatefulWidget {
final TextEditingController standortC;
const Standort({super.key, required this.standortC});
@override
State<Standort> createState() => _StandortState();
}
class _StandortState extends State<Standort> {
String? selectedRudel;
late Future<List<Map<String, dynamic>>> Standort;
@override
void initState() {
super.initState();
Standort = DBHelper().getPlace();
}
@override
Widget build(BuildContext context) {
return Row(
children: [
Expanded(
flex: 3,
child: TextField(
keyboardType: TextInputType.multiline,
maxLines: null,
decoration: InputDecoration(
hintText: AppLocalizations.of(context)!.altstort,
enabledBorder: widget.standortC.text.isEmpty
? const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.red))
: const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.green)),
focusedBorder: widget.standortC.text.isEmpty
? const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.red))
: const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.green)),
),
controller: widget.standortC,
)),
Expanded(
flex: 1,
child: Align(
alignment: Alignment.bottomLeft,
child: FutureBuilder<List<Map<String, dynamic>>>(
future: Standort,
builder: (BuildContext context,
AsyncSnapshot<List<Map<String, dynamic>>> snapshot) {
if (snapshot.hasData) {
var filteredData = snapshot.data!
.where((item) => item['Standort'] != null)
.toList();
return DropdownButton<String>(
items: filteredData
.map((item) =>
buildMenuItem(item['Standort'].toString()))
.toList(),
onChanged: (value) {
setState(
() {
selectedRudel = value;
widget.standortC.text = value ?? '';
},
);
},
value: null,
underline: const SizedBox(),
);
} else if (snapshot.hasError) {
return Text('Fehler: ${snapshot.error}');
} else {
return const CircularProgressIndicator();
}
},
),
),
)
],
);
}
DropdownMenuItem<String> buildMenuItem(String item) => DropdownMenuItem(
value: item,
child: Text(item),
);
}
>>>>>>> d6ae86598dd9d031af9fe29680dc050c5bb2946f
// KTage1
class KTage1 extends StatefulWidget {