Files
stadtbote-app/lib/popups/tasks_popups/pickup_delivery_status_popup.dart
T
2024-02-10 09:47:29 +01:00

75 lines
3.1 KiB
Dart

import 'package:flutter/material.dart';
// ignore: unused_import
import 'package:kumi_popup_window/kumi_popup_window.dart';
import 'package:stadtbote/model/task_info.dart';
import 'package:stadtbote/model/tour_task.dart';
import 'package:stadtbote/tools/util.dart';
showPickupDeliveryStatusPopup(BuildContext context, TaskInfo taskInfo, Function(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);
}
await showDialog<void>(
context: context,
builder: (BuildContext context) {
TourEntry? selectedTourEntry;
TextEditingController controller = TextEditingController();
return AlertDialog(
contentPadding: EdgeInsets.zero,
shadowColor: Colors.transparent,
backgroundColor: Colors.white,
content: StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return SizedBox(
key: GlobalKey(),
height: 280,
width: MediaQuery.of(context).size.width * 0.8,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.white,
border: Border.all(
color: Colors.grey,
width: 0.5,
),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text(taskInfo.task.topic),
const SizedBox(height: 20),
DropdownMenu<TourEntry>(
expandedInsets: const EdgeInsets.all(0),
controller: controller,
hintText: 'Status',
onSelected: (TourEntry? value) {
selectedTourEntry = value;
controller.text = value!.text;
setState(() {});
},
dropdownMenuEntries: entries,
),
const SizedBox(height: 20),
Visibility(visible: selectedTourEntry != null ? selectedTourEntry!.queryRemark : false, child: Util.getDefaultTextField("Bemerkung")),
const SizedBox(height: 20),
getDefaultButton('Übernehmen', buttonHeight: 50, () => {
Navigator.of(context).pop(),
onFinished(selectedTourEntry)
})
],
),
),
));
},
));
});
}