Fehlerkorrekturen und Erweiterungen
This commit is contained in:
1 parent
584f7dc8f7
commit
81133905de
38 files changed
+1003
-222
No files matched your search
@@ -1,9 +1,19 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:stadtbote/model/task_info.dart';
|
||||
import 'package:stadtbote/model/tour_task.dart';
|
||||
import 'package:stadtbote/tools/util.dart';
|
||||
|
||||
showReceiptGiverPopup(BuildContext context, TaskInfo taskInfo, Function(String) onFinished) async {
|
||||
showReceiptGiverPopup(BuildContext context, TaskInfo taskInfo, Function(String, TourEntry) onFinished) async {
|
||||
List<DropdownMenuEntry<TourEntry>> entries = [];
|
||||
for (var entry in taskInfo.task.entries!) {
|
||||
var dropdownMenuEntry = DropdownMenuEntry<TourEntry>(value: entry, label: entry.text);
|
||||
entries.add(dropdownMenuEntry);
|
||||
}
|
||||
|
||||
TextEditingController controller = TextEditingController();
|
||||
TourEntry? selectedTourEntry;
|
||||
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
@@ -20,7 +30,7 @@ showReceiptGiverPopup(BuildContext context, TaskInfo taskInfo, Function(String)
|
||||
|
||||
return SizedBox(
|
||||
key: GlobalKey(),
|
||||
height: 260,
|
||||
height: 350,
|
||||
width: MediaQuery.of(context).size.width * 0.8,
|
||||
child: Container(
|
||||
height: 100,
|
||||
@@ -38,6 +48,18 @@ showReceiptGiverPopup(BuildContext context, TaskInfo taskInfo, Function(String)
|
||||
children: [
|
||||
Text(taskInfo.task.topic),
|
||||
const SizedBox(height: 20),
|
||||
DropdownMenu<TourEntry>(
|
||||
expandedInsets: const EdgeInsets.all(0),
|
||||
controller: controller,
|
||||
hintText: 'Geschlecht',
|
||||
onSelected: (TourEntry? value) {
|
||||
selectedTourEntry = value;
|
||||
|
||||
controller.text = value!.text;
|
||||
},
|
||||
dropdownMenuEntries: entries,
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
Util.getDefaultTextField(taskInfo.task.topic,
|
||||
textInputType: TextInputType.text,
|
||||
formatter: [FilteringTextInputFormatter.singleLineFormatter],
|
||||
@@ -46,12 +68,12 @@ showReceiptGiverPopup(BuildContext context, TaskInfo taskInfo, Function(String)
|
||||
autofocus: true),
|
||||
const SizedBox(height: 20),
|
||||
getDefaultButton('Übernehmen', () {
|
||||
if (textEditingController.text.isNotEmpty) {
|
||||
if (textEditingController.text.isNotEmpty && selectedTourEntry != null) {
|
||||
Navigator.of(context).pop();
|
||||
|
||||
onFinished(textEditingController.text);
|
||||
onFinished(textEditingController.text, selectedTourEntry!);
|
||||
} else {
|
||||
showAlertDialog("Fehler", "Sie müssen einen Text eingeben");
|
||||
showAlertDialog("Fehler", "Sie müssen einen Text eingeben und ein Geschlecht auswählen");
|
||||
}
|
||||
})
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user