Erweiterungen
This commit is contained in:
1 parent
17e7ce6fad
commit
054dfe616e
14 files changed
+297
-189
No files matched your search
@@ -218,7 +218,7 @@ class _TaskListPageState extends State<TaskListPage> {
|
||||
taskInfo.sId = task.sId;
|
||||
taskInfo.answer = null;
|
||||
taskInfo.additionalText = null;
|
||||
taskInfo.completed = task.opt != null ? task.opt! : false;
|
||||
taskInfo.completed = false;
|
||||
}
|
||||
|
||||
taskInfo.task = task;
|
||||
@@ -265,6 +265,8 @@ class _TaskListPageState extends State<TaskListPage> {
|
||||
}
|
||||
|
||||
_processTaskArrivedOrFinished(TaskInfo taskInfo) {
|
||||
Util.logInfo('Task ${taskInfo.task.sId} called');
|
||||
|
||||
showTaskArrivedPopup(context, taskInfo, () {
|
||||
DateFormat dateFormat = DateFormat("dd.MM.yyyy HH:mm");
|
||||
|
||||
@@ -283,6 +285,8 @@ class _TaskListPageState extends State<TaskListPage> {
|
||||
}
|
||||
|
||||
_processCommissionNumber(TaskInfo taskInfo) {
|
||||
Util.logInfo('Task ${taskInfo.task.sId} called');
|
||||
|
||||
showComissionNumberPopup(context, taskInfo, (comissionNumber) {
|
||||
var answer = _createAnswerHeader(taskInfo);
|
||||
answer.val = comissionNumber;
|
||||
@@ -300,6 +304,8 @@ class _TaskListPageState extends State<TaskListPage> {
|
||||
}
|
||||
|
||||
_processScanBarcodes(TaskInfo taskInfo) {
|
||||
Util.logInfo('Task ${taskInfo.task.sId} called');
|
||||
|
||||
showScanBarcodesPopup(context, taskInfo, (List<String> barcodes) {
|
||||
var answer = _createAnswerHeader(taskInfo);
|
||||
answer.codes = [];
|
||||
@@ -318,6 +324,8 @@ class _TaskListPageState extends State<TaskListPage> {
|
||||
}
|
||||
|
||||
_processTakePhotos(TaskInfo taskInfo) {
|
||||
Util.logInfo('Task ${taskInfo.task.sId} called');
|
||||
|
||||
showTakePhotosPopup(context, taskInfo, (List<Uint8List>? photos) async {
|
||||
if (photos != null) {
|
||||
await MyApp.isarInstance.writeTxn(() async {
|
||||
@@ -345,6 +353,8 @@ class _TaskListPageState extends State<TaskListPage> {
|
||||
}
|
||||
|
||||
void _processStationNotice(TaskInfo taskInfo) {
|
||||
Util.logInfo('Task ${taskInfo.task.sId} called');
|
||||
|
||||
showStationNoticePopup(context, taskInfo, (notice) {
|
||||
var answer = _createAnswerHeader(taskInfo);
|
||||
answer.val = notice;
|
||||
@@ -360,6 +370,8 @@ class _TaskListPageState extends State<TaskListPage> {
|
||||
}
|
||||
|
||||
void _processReceiptGiver(TaskInfo taskInfo) {
|
||||
Util.logInfo('Task ${taskInfo.task.sId} called');
|
||||
|
||||
showReceiptGiverPopup(context, taskInfo, (receiptGiver) {
|
||||
var answer = _createAnswerHeader(taskInfo);
|
||||
answer.val = receiptGiver;
|
||||
@@ -375,10 +387,13 @@ class _TaskListPageState extends State<TaskListPage> {
|
||||
}
|
||||
|
||||
void _processPickupDeliveryStatusTask(TaskInfo taskInfo) {
|
||||
Util.logInfo('Task ${taskInfo.task.sId} called');
|
||||
|
||||
Future.delayed(const Duration(seconds: 1), () async {
|
||||
showPickupDeliveryStatusPopup(context, taskInfo, (tourEntry) {
|
||||
showPickupDeliveryStatusPopup(context, taskInfo, (tourEntry, remark) {
|
||||
var answer = _createAnswerHeader(taskInfo);
|
||||
answer.code = tourEntry!.code;
|
||||
answer.val = remark;
|
||||
|
||||
taskInfo.answer = jsonEncode(answer.toJson());
|
||||
taskInfo.additionalText = tourEntry.text;
|
||||
@@ -392,6 +407,8 @@ class _TaskListPageState extends State<TaskListPage> {
|
||||
}
|
||||
|
||||
void _processSignature(TaskInfo taskInfo) {
|
||||
Util.logInfo('Task ${taskInfo.task.sId} called');
|
||||
|
||||
MyApp.suppressAcceptDialog = true;
|
||||
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft]);
|
||||
@@ -407,6 +424,7 @@ class _TaskListPageState extends State<TaskListPage> {
|
||||
answer.sign = signature;
|
||||
|
||||
taskInfo.answer = jsonEncode(answer.toJson());
|
||||
taskInfo.additionalText = "Unterschrift erfasst";
|
||||
taskInfo.completed = true;
|
||||
|
||||
_sendFinTourMessage();
|
||||
|
||||
@@ -39,9 +39,24 @@ void showInfosPopup(BuildContext context, SessionStatus? status) async {
|
||||
shadowColor: Colors.transparent,
|
||||
backgroundColor: Colors.white,
|
||||
content: StatefulBuilder(builder: (BuildContext context, StateSetter setState) {
|
||||
String getGpsStatustext() {
|
||||
String gpsStatus = "nicht verfügbar";
|
||||
if (MyApp.currentPosition != null) {
|
||||
var nowUtc = DateTime.now().toUtc();
|
||||
var minutesDelta = nowUtc.difference(MyApp.currentPosition!.timestamp);
|
||||
|
||||
if (minutesDelta >= const Duration(minutes: 15)) {
|
||||
gpsStatus = "veraltet";
|
||||
} else {
|
||||
gpsStatus = "aktuell";
|
||||
}
|
||||
}
|
||||
return gpsStatus;
|
||||
}
|
||||
|
||||
var text = "Versionsnummer: a$version\n";
|
||||
text += "Verbindungsstatus: $connectedString\n";
|
||||
text += "GPS-Status: ${MyApp.currentPosition != null ? MyApp.currentPosition!.timestamp.toString() : "Unbekannt"}\n";
|
||||
text += "GPS-Status: ${getGpsStatustext()}\n";
|
||||
text += "\n";
|
||||
text += "User Status:\n";
|
||||
if (status != null) {
|
||||
@@ -103,3 +118,5 @@ void showInfosPopup(BuildContext context, SessionStatus? status) async {
|
||||
})));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
),
|
||||
),
|
||||
));
|
||||
}));
|
||||
})));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -165,14 +165,16 @@ class MqttCore {
|
||||
try {
|
||||
final MqttPublishMessage message = mqttMessage.payload as MqttPublishMessage;
|
||||
|
||||
var messageBytes = message.payload.message;
|
||||
String payload = utf8.decode(GZipDecoder().decodeBytes(messageBytes));
|
||||
|
||||
var topicArray = message.variableHeader?.topicName;
|
||||
var topicArraySplited = topicArray!.split("/");
|
||||
var topic = topicArraySplited[6];
|
||||
|
||||
Util.logInfo('message received\ntopic: $topic\nmessage: $payload');
|
||||
Util.logInfo('message received\ntopic: $topic\n');
|
||||
|
||||
var messageBytes = message.payload.message;
|
||||
String payload = utf8.decode(GZipDecoder().decodeBytes(messageBytes));
|
||||
|
||||
Util.logInfo('$topic\nmessage: $payload');
|
||||
|
||||
switch (topic) {
|
||||
case 'session':
|
||||
@@ -347,8 +349,6 @@ class MqttCore {
|
||||
|
||||
await Util.playMp3('asbeep.mp3');
|
||||
|
||||
|
||||
|
||||
MessageService().publish<MessageReceivedMessage>(Constants.messageTopicMessageReceived, arguments: MessageReceivedMessage(message: newMessage));
|
||||
}
|
||||
|
||||
|
||||
+29
-1
@@ -360,6 +360,19 @@ String mapTourMode(String mode) {
|
||||
return text;
|
||||
}
|
||||
|
||||
Future<void> showQuestionDialog(BuildContext context, String title, String message, List<Widget> actions) async {
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text(title),
|
||||
content: Text(message),
|
||||
actions: actions,
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> showAlertDialog(BuildContext context, String title, String message) async {
|
||||
await showDialog(
|
||||
context: context,
|
||||
@@ -406,4 +419,19 @@ class DecimalTextInputFormatter extends TextInputFormatter {
|
||||
|
||||
bool isJobInFuture(Job job) {
|
||||
return DateTime.parse(job.ordertime).add(Duration(minutes: job.offsWarn)).toUtc().millisecondsSinceEpoch > DateTime.now().toUtc().millisecondsSinceEpoch;
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> taskDialogSecurityException(BuildContext context) async {
|
||||
bool close = false;
|
||||
|
||||
await showQuestionDialog(context, "Achtung", "Wenn Sie den Dialog jetzt schließen gehen erfasste Daten verloren und die Aufgabe oder Station bleibt unerledigt.", [
|
||||
TextButton(onPressed: () => {Navigator.of(context).pop(), close = true}, child: const Text('Schließen')),
|
||||
TextButton(onPressed: () => {Navigator.of(context).pop(), close = false}, child: const Text('Zurück')),
|
||||
]);
|
||||
|
||||
if (close) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
|
||||
return close;
|
||||
}
|
||||
Reference in new issue
Block a user