filtered double entries, fixed betreuung dropdown, fixed abbau
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
|
||||
import 'package:fforte/other/db_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
@@ -14,7 +14,8 @@ class VarTextField extends StatefulWidget {
|
||||
final TextEditingController textController;
|
||||
final String localization;
|
||||
final String dbName;
|
||||
final String? default_value;
|
||||
final String? defaultValue;
|
||||
final String? otherDefault;
|
||||
final bool required;
|
||||
|
||||
const VarTextField(
|
||||
@@ -23,7 +24,8 @@ class VarTextField extends StatefulWidget {
|
||||
required this.localization,
|
||||
required this.dbName,
|
||||
required this.required,
|
||||
this.default_value});
|
||||
this.defaultValue,
|
||||
this.otherDefault});
|
||||
|
||||
@override
|
||||
State<VarTextField> createState() => _VarTextFieldState();
|
||||
@@ -36,10 +38,14 @@ class _VarTextFieldState extends State<VarTextField> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
if (widget.textController.text == "" && widget.default_value != null) {
|
||||
if (widget.textController.text == "" && widget.defaultValue != null) {
|
||||
_loadPref();
|
||||
}
|
||||
|
||||
if (widget.otherDefault != null) {
|
||||
widget.textController.text = widget.otherDefault!;
|
||||
}
|
||||
|
||||
dbVar = _loadData();
|
||||
}
|
||||
|
||||
@@ -52,7 +58,7 @@ class _VarTextFieldState extends State<VarTextField> {
|
||||
void _loadPref() {
|
||||
Future.delayed(Duration.zero, () async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
String bLand = prefs.getString(widget.default_value!) ?? "";
|
||||
String bLand = prefs.getString(widget.defaultValue!) ?? "";
|
||||
setState(() {
|
||||
widget.textController.text = bLand;
|
||||
});
|
||||
@@ -93,8 +99,10 @@ class _VarTextFieldState extends State<VarTextField> {
|
||||
: const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey))),
|
||||
)),
|
||||
const SizedBox(
|
||||
width: 15,
|
||||
const Expanded(
|
||||
child: SizedBox(
|
||||
width: 15,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
@@ -111,6 +119,9 @@ class _VarTextFieldState extends State<VarTextField> {
|
||||
item[widget.dbName] != null &&
|
||||
item[widget.dbName] != "")
|
||||
.toList();
|
||||
|
||||
var uniqueData = { ...filteredData.map((e) => e[widget.dbName].toString())};
|
||||
|
||||
return PopupMenuButton<String>(
|
||||
onSelected: (String value) {
|
||||
setState(() {
|
||||
@@ -118,10 +129,10 @@ class _VarTextFieldState extends State<VarTextField> {
|
||||
});
|
||||
},
|
||||
itemBuilder: (BuildContext context) {
|
||||
return filteredData
|
||||
.map((item) => PopupMenuItem<String>(
|
||||
value: item[widget.dbName].toString(),
|
||||
child: Text(item[widget.dbName].toString()),
|
||||
return uniqueData
|
||||
.map((value) => PopupMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value),
|
||||
))
|
||||
.toList();
|
||||
},
|
||||
@@ -141,6 +152,8 @@ class _VarTextFieldState extends State<VarTextField> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Karte
|
||||
// ! completely new page
|
||||
|
||||
@@ -810,7 +823,7 @@ class _AbbauDatState extends State<AbbauDat> {
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
Row(children: [
|
||||
Column(children: [
|
||||
SizedBox(
|
||||
width: 140,
|
||||
child: ElevatedButton(
|
||||
@@ -822,6 +835,8 @@ class _AbbauDatState extends State<AbbauDat> {
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.pickabbaudat)),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
@@ -844,6 +859,8 @@ class _AbbauDatState extends State<AbbauDat> {
|
||||
},
|
||||
child: const Text("X"))
|
||||
]),
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -856,6 +873,6 @@ class _AbbauDatState extends State<AbbauDat> {
|
||||
lastDate: DateTime(5000));
|
||||
if (date == null) return null;
|
||||
|
||||
return abbauDat;
|
||||
return date;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user