Erweiterungen
This commit is contained in:
1 parent
17e7ce6fad
commit
054dfe616e
14 files changed
+297
-189
No files matched your search
@@ -5,50 +5,41 @@ import 'package:stadtbote/tools/util.dart';
|
||||
showTaskArrivedPopup(BuildContext context, TaskInfo taskInfo, Function() onFinished) async {
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context)
|
||||
{
|
||||
return AlertDialog(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
shadowColor: Colors.transparent,
|
||||
backgroundColor: Colors.white,
|
||||
content: StatefulBuilder(builder: (BuildContext context, StateSetter setState) {
|
||||
return SizedBox(
|
||||
key: GlobalKey(),
|
||||
height: MediaQuery
|
||||
.of(context)
|
||||
.size
|
||||
.height * 0.2,
|
||||
width: MediaQuery
|
||||
.of(context)
|
||||
.size
|
||||
.width * 0.8,
|
||||
child: Container(
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(35.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(taskInfo.task.topic),
|
||||
const SizedBox(height: 20),
|
||||
getDefaultButton(taskInfo.task.topic, () =>
|
||||
{
|
||||
Navigator.of(context).pop(),
|
||||
|
||||
onFinished()
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
}));
|
||||
});
|
||||
builder: (BuildContext context) {
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
return await taskDialogSecurityException(context);
|
||||
}, // False will prevent and true will allow to dismiss
|
||||
child: AlertDialog(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
shadowColor: Colors.transparent,
|
||||
backgroundColor: Colors.white,
|
||||
content: StatefulBuilder(builder: (BuildContext context, StateSetter setState) {
|
||||
return SizedBox(
|
||||
key: GlobalKey(),
|
||||
height: MediaQuery.of(context).size.height * 0.2,
|
||||
width: MediaQuery.of(context).size.width * 0.8,
|
||||
child: Container(
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(35.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(taskInfo.task.topic),
|
||||
const SizedBox(height: 20),
|
||||
getDefaultButton(taskInfo.task.topic, () => {Navigator.of(context).pop(), onFinished()}),
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
})));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,47 +7,48 @@ showComissionNumberPopup(BuildContext context, TaskInfo taskInfo, Function(Strin
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
shadowColor: Colors.transparent,
|
||||
backgroundColor: Colors.white,
|
||||
content: StatefulBuilder(builder: (BuildContext context, StateSetter setState) {
|
||||
TextEditingController textEditingController = TextEditingController();
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
return await taskDialogSecurityException(context);
|
||||
},
|
||||
child: AlertDialog(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
shadowColor: Colors.transparent,
|
||||
backgroundColor: Colors.white,
|
||||
content: StatefulBuilder(builder: (BuildContext context, StateSetter setState) {
|
||||
TextEditingController textEditingController = TextEditingController();
|
||||
|
||||
return SizedBox(
|
||||
key: GlobalKey(),
|
||||
height: 260,
|
||||
width: MediaQuery.of(context).size.width * 0.8,
|
||||
child: Container(
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(35.0),
|
||||
child: Column(
|
||||
children: [
|
||||
const Text('Bitte geben Sie die Kommisionsnummer ein'),
|
||||
const SizedBox(height: 20),
|
||||
Util.getDefaultTextField('Kommisionsnummer',
|
||||
textInputType: TextInputType.text,
|
||||
formatter: [FilteringTextInputFormatter.singleLineFormatter],
|
||||
controller: textEditingController,
|
||||
autofocus: true),
|
||||
const SizedBox(height: 20),
|
||||
getDefaultButton('Übernehmen', () => {
|
||||
Navigator.of(context).pop(),
|
||||
|
||||
onFinished(textEditingController.text)})
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
}));
|
||||
return SizedBox(
|
||||
key: GlobalKey(),
|
||||
height: 260,
|
||||
width: MediaQuery.of(context).size.width * 0.8,
|
||||
child: Container(
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(35.0),
|
||||
child: Column(
|
||||
children: [
|
||||
const Text('Bitte geben Sie die Kommisionsnummer ein'),
|
||||
const SizedBox(height: 20),
|
||||
Util.getDefaultTextField('Kommisionsnummer',
|
||||
textInputType: TextInputType.text,
|
||||
formatter: [FilteringTextInputFormatter.singleLineFormatter],
|
||||
controller: textEditingController,
|
||||
autofocus: true),
|
||||
const SizedBox(height: 20),
|
||||
getDefaultButton('Übernehmen', () => {Navigator.of(context).pop(), onFinished(textEditingController.text)})
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
})));
|
||||
});
|
||||
}
|
||||
@@ -3,7 +3,7 @@ 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 {
|
||||
showPickupDeliveryStatusPopup(BuildContext context, TaskInfo taskInfo, Function(TourEntry?, String? remark) onFinished) async {
|
||||
List<DropdownMenuEntry<TourEntry>> entries = [];
|
||||
for (var entry in taskInfo.task.entries!) {
|
||||
var dropdownMenuEntry = DropdownMenuEntry<TourEntry>(value: entry, label: entry.text);
|
||||
@@ -16,8 +16,13 @@ showPickupDeliveryStatusPopup(BuildContext context, TaskInfo taskInfo, Function(
|
||||
TourEntry? selectedTourEntry;
|
||||
|
||||
TextEditingController controller = TextEditingController();
|
||||
TextEditingController remController = TextEditingController();
|
||||
|
||||
return AlertDialog(
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
return await taskDialogSecurityException(context);
|
||||
},
|
||||
child: AlertDialog(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
shadowColor: Colors.transparent,
|
||||
backgroundColor: Colors.white,
|
||||
@@ -55,18 +60,28 @@ showPickupDeliveryStatusPopup(BuildContext context, TaskInfo taskInfo, Function(
|
||||
dropdownMenuEntries: entries,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Visibility(visible: selectedTourEntry != null ? selectedTourEntry!.queryRemark : false, child: Util.getDefaultTextField("Bemerkung")),
|
||||
Visibility(visible: selectedTourEntry != null ? selectedTourEntry!.queryRemark : false, child: Util.getDefaultTextField(controller: remController, "Bemerkung")),
|
||||
const SizedBox(height: 20),
|
||||
getDefaultButton('Übernehmen', buttonHeight: 50, () => {
|
||||
Navigator.of(context).pop(),
|
||||
if (selectedTourEntry!.queryRemark) {
|
||||
if (remController.text.isNotEmpty) {
|
||||
Navigator.of(context).pop(),
|
||||
|
||||
onFinished(selectedTourEntry)
|
||||
onFinished(selectedTourEntry, remController.text)
|
||||
} else {
|
||||
showAlertDialog(context, "Fehler", "Bitte geben Sie eine Bemerkung ein")
|
||||
}
|
||||
} else {
|
||||
Navigator.of(context).pop(),
|
||||
|
||||
onFinished(selectedTourEntry, null)
|
||||
}
|
||||
})
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
},
|
||||
));
|
||||
)));
|
||||
});
|
||||
}
|
||||
@@ -7,7 +7,11 @@ showReceiptGiverPopup(BuildContext context, TaskInfo taskInfo, Function(String)
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
return await taskDialogSecurityException(context);
|
||||
},
|
||||
child: AlertDialog(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
shadowColor: Colors.transparent,
|
||||
backgroundColor: Colors.white,
|
||||
@@ -53,6 +57,6 @@ showReceiptGiverPopup(BuildContext context, TaskInfo taskInfo, Function(String)
|
||||
),
|
||||
),
|
||||
));
|
||||
}));
|
||||
})));
|
||||
});
|
||||
}
|
||||
@@ -8,7 +8,11 @@ showScanBarcodesPopup(BuildContext context, TaskInfo taskInfo, Function(List<Str
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
return await taskDialogSecurityException(context);
|
||||
},
|
||||
child: AlertDialog(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
shadowColor: Colors.transparent,
|
||||
backgroundColor: Colors.white,
|
||||
@@ -93,6 +97,6 @@ showScanBarcodesPopup(BuildContext context, TaskInfo taskInfo, Function(List<Str
|
||||
),
|
||||
),
|
||||
));
|
||||
}));
|
||||
})));
|
||||
});
|
||||
}
|
||||
@@ -9,82 +9,78 @@ showSignaturePopup(BuildContext context, TaskInfo taskInfo, Function(String?) on
|
||||
builder: (BuildContext context) {
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
Navigator.of(context).pop();
|
||||
return await taskDialogSecurityException(context);
|
||||
},
|
||||
child: AlertDialog(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
shadowColor: Colors.transparent,
|
||||
backgroundColor: Colors.white,
|
||||
content: StatefulBuilder(
|
||||
builder: (BuildContext context, StateSetter setState) {
|
||||
final SignatureController controller = SignatureController();
|
||||
|
||||
onFinished(null);
|
||||
var popupHeight = MediaQuery.of(context).size.height * 0.85;
|
||||
var popupWidth = MediaQuery.of(context).size.width * 0.85;
|
||||
|
||||
return true;
|
||||
},// False will prevent and true will allow to dismiss
|
||||
child: AlertDialog(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
shadowColor: Colors.transparent,
|
||||
backgroundColor: Colors.white,
|
||||
content: StatefulBuilder(
|
||||
builder: (BuildContext context, StateSetter setState) {
|
||||
final SignatureController controller = SignatureController();
|
||||
String convertPoints(List<Point> points) {
|
||||
if (points.isNotEmpty) {
|
||||
String result = "";
|
||||
|
||||
var popupHeight = MediaQuery.of(context).size.height * 0.85;
|
||||
var popupWidth = MediaQuery.of(context).size.width * 0.85;
|
||||
for (var point in points) {
|
||||
if (point.type != PointType.tap) {
|
||||
result += "${point.offset.dx.toInt()},${point.offset.dy.toInt()};";
|
||||
} else {
|
||||
result += "A";
|
||||
}
|
||||
}
|
||||
|
||||
String convertPoints(List<Point> points) {
|
||||
if (points.isNotEmpty) {
|
||||
String result = "";
|
||||
|
||||
for (var point in points) {
|
||||
if (point.type != PointType.tap) {
|
||||
result += "${point.offset.dx.toInt()},${point.offset.dy.toInt()};";
|
||||
} else {
|
||||
result += "A";
|
||||
return result.replaceAll("AA", "A");
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
return result.replaceAll("AA", "A");
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
return SizedBox(
|
||||
key: GlobalKey(),
|
||||
height: popupHeight,
|
||||
width: popupWidth,
|
||||
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(20.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(taskInfo.task.topic),
|
||||
const SizedBox(height: 20),
|
||||
Expanded(
|
||||
child: Signature(
|
||||
controller: controller,
|
||||
width: 500,
|
||||
height: 200,
|
||||
backgroundColor: Colors.lightBlueAccent,
|
||||
),
|
||||
return SizedBox(
|
||||
key: GlobalKey(),
|
||||
height: popupHeight,
|
||||
width: popupWidth,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
width: 0.5,
|
||||
),
|
||||
getDefaultButton('Übernehmen', buttonHeight: 50, () => {
|
||||
if (controller.points.length > 50) {
|
||||
Navigator.of(context).pop(),
|
||||
|
||||
onFinished(convertPoints(controller.points))
|
||||
} else {
|
||||
showAlertDialog(context, "Fehler", "Die Unterschrift ist zu kurz.")
|
||||
}
|
||||
})
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
},
|
||||
)));
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(taskInfo.task.topic),
|
||||
const SizedBox(height: 20),
|
||||
Expanded(
|
||||
child: Signature(
|
||||
controller: controller,
|
||||
width: 500,
|
||||
height: 200,
|
||||
backgroundColor: Colors.lightBlueAccent,
|
||||
),
|
||||
),
|
||||
getDefaultButton(
|
||||
'Übernehmen',
|
||||
buttonHeight: 50,
|
||||
() => {
|
||||
if (controller.points.length > 50)
|
||||
{Navigator.of(context).pop(), onFinished(convertPoints(controller.points))}
|
||||
else
|
||||
{showAlertDialog(context, "Fehler", "Die Unterschrift ist zu kurz.")}
|
||||
})
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
},
|
||||
)));
|
||||
});
|
||||
}
|
||||
@@ -7,7 +7,11 @@ showStationNoticePopup(BuildContext context, TaskInfo taskInfo, Function(String)
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
return await taskDialogSecurityException(context);
|
||||
},
|
||||
child: AlertDialog(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
shadowColor: Colors.transparent,
|
||||
backgroundColor: Colors.white,
|
||||
@@ -52,7 +56,7 @@ showStationNoticePopup(BuildContext context, TaskInfo taskInfo, Function(String)
|
||||
),
|
||||
),
|
||||
));
|
||||
}));
|
||||
})));
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -9,12 +9,18 @@ Future<void> showTakePhotosPopup(BuildContext context, TaskInfo taskInfo, Functi
|
||||
List<Uint8List> imageDataList = [];
|
||||
List<Widget> imageWidgetsList = [];
|
||||
|
||||
int currentCarousselSliderIndex = 0;
|
||||
|
||||
ValueNotifier<List<Widget>> imageWidgetsListNotifier = ValueNotifier<List<Widget>>([]);
|
||||
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
return await taskDialogSecurityException(context);
|
||||
},
|
||||
child: AlertDialog(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
shadowColor: Colors.transparent,
|
||||
backgroundColor: Colors.white,
|
||||
@@ -39,7 +45,24 @@ Future<void> showTakePhotosPopup(BuildContext context, TaskInfo taskInfo, Functi
|
||||
|
||||
imageWidgetsList.add(GestureDetector(
|
||||
onTap: () {},
|
||||
child: Image.memory(resizedImageData),
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
await showQuestionDialog(context, "Achtung", "Wollen Sie das Bild wirklich löschen?", [
|
||||
TextButton(onPressed: () => {Navigator.of(context).pop(),
|
||||
imageDataList.removeAt(currentCarousselSliderIndex),
|
||||
imageWidgetsList.removeAt(currentCarousselSliderIndex),
|
||||
|
||||
Util.logInfo("image deleted $currentCarousselSliderIndex"),
|
||||
|
||||
currentCarousselSliderIndex = 0,
|
||||
|
||||
setState(() {})
|
||||
}, child: const Text('Ja')),
|
||||
TextButton(onPressed: () => {Navigator.of(context).pop()}, child: const Text('Nein')),
|
||||
]);
|
||||
},
|
||||
child: Image.memory(resizedImageData),
|
||||
)
|
||||
));
|
||||
|
||||
imageWidgetsListNotifier.value = imageWidgetsList;
|
||||
@@ -86,11 +109,14 @@ Future<void> showTakePhotosPopup(BuildContext context, TaskInfo taskInfo, Functi
|
||||
valueListenable: imageWidgetsListNotifier,
|
||||
builder: (context, value, child) {
|
||||
return CarouselSlider(
|
||||
options: CarouselOptions(
|
||||
disableCenter: false,
|
||||
enableInfiniteScroll: false,
|
||||
),
|
||||
items: imageWidgetsList.toList());
|
||||
options: CarouselOptions(
|
||||
disableCenter: false,
|
||||
enableInfiniteScroll: false,
|
||||
onPageChanged: (index, reason) {
|
||||
currentCarousselSliderIndex = index;
|
||||
},
|
||||
),
|
||||
items: imageWidgetsList.toList());
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -112,6 +138,6 @@ Future<void> showTakePhotosPopup(BuildContext context, TaskInfo taskInfo, Functi
|
||||
),
|
||||
),
|
||||
));
|
||||
}));
|
||||
})));
|
||||
});
|
||||
}
|
||||
@@ -5,7 +5,11 @@ showZipPopup(BuildContext context, String text, String buttonText, Function(Stri
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
return await taskDialogSecurityException(context);
|
||||
},
|
||||
child: AlertDialog(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
shadowColor: Colors.transparent,
|
||||
backgroundColor: Colors.white,
|
||||
@@ -48,7 +52,7 @@ showZipPopup(BuildContext context, String text, String buttonText, Function(Stri
|
||||
),
|
||||
),
|
||||
));
|
||||
}));
|
||||
})));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user