Erweiterungen

This commit is contained in:
Sven committed 2024-05-29 20:34:22 +02:00
1 parent 17e7ce6fad
commit 054dfe616e
14 files changed
+297 -189

No files matched your search

+20 -2
View File
@@ -218,7 +218,7 @@ class _TaskListPageState extends State<TaskListPage> {
taskInfo.sId = task.sId; taskInfo.sId = task.sId;
taskInfo.answer = null; taskInfo.answer = null;
taskInfo.additionalText = null; taskInfo.additionalText = null;
taskInfo.completed = task.opt != null ? task.opt! : false; taskInfo.completed = false;
} }
taskInfo.task = task; taskInfo.task = task;
@@ -265,6 +265,8 @@ class _TaskListPageState extends State<TaskListPage> {
} }
_processTaskArrivedOrFinished(TaskInfo taskInfo) { _processTaskArrivedOrFinished(TaskInfo taskInfo) {
Util.logInfo('Task ${taskInfo.task.sId} called');
showTaskArrivedPopup(context, taskInfo, () { showTaskArrivedPopup(context, taskInfo, () {
DateFormat dateFormat = DateFormat("dd.MM.yyyy HH:mm"); DateFormat dateFormat = DateFormat("dd.MM.yyyy HH:mm");
@@ -283,6 +285,8 @@ class _TaskListPageState extends State<TaskListPage> {
} }
_processCommissionNumber(TaskInfo taskInfo) { _processCommissionNumber(TaskInfo taskInfo) {
Util.logInfo('Task ${taskInfo.task.sId} called');
showComissionNumberPopup(context, taskInfo, (comissionNumber) { showComissionNumberPopup(context, taskInfo, (comissionNumber) {
var answer = _createAnswerHeader(taskInfo); var answer = _createAnswerHeader(taskInfo);
answer.val = comissionNumber; answer.val = comissionNumber;
@@ -300,6 +304,8 @@ class _TaskListPageState extends State<TaskListPage> {
} }
_processScanBarcodes(TaskInfo taskInfo) { _processScanBarcodes(TaskInfo taskInfo) {
Util.logInfo('Task ${taskInfo.task.sId} called');
showScanBarcodesPopup(context, taskInfo, (List<String> barcodes) { showScanBarcodesPopup(context, taskInfo, (List<String> barcodes) {
var answer = _createAnswerHeader(taskInfo); var answer = _createAnswerHeader(taskInfo);
answer.codes = []; answer.codes = [];
@@ -318,6 +324,8 @@ class _TaskListPageState extends State<TaskListPage> {
} }
_processTakePhotos(TaskInfo taskInfo) { _processTakePhotos(TaskInfo taskInfo) {
Util.logInfo('Task ${taskInfo.task.sId} called');
showTakePhotosPopup(context, taskInfo, (List<Uint8List>? photos) async { showTakePhotosPopup(context, taskInfo, (List<Uint8List>? photos) async {
if (photos != null) { if (photos != null) {
await MyApp.isarInstance.writeTxn(() async { await MyApp.isarInstance.writeTxn(() async {
@@ -345,6 +353,8 @@ class _TaskListPageState extends State<TaskListPage> {
} }
void _processStationNotice(TaskInfo taskInfo) { void _processStationNotice(TaskInfo taskInfo) {
Util.logInfo('Task ${taskInfo.task.sId} called');
showStationNoticePopup(context, taskInfo, (notice) { showStationNoticePopup(context, taskInfo, (notice) {
var answer = _createAnswerHeader(taskInfo); var answer = _createAnswerHeader(taskInfo);
answer.val = notice; answer.val = notice;
@@ -360,6 +370,8 @@ class _TaskListPageState extends State<TaskListPage> {
} }
void _processReceiptGiver(TaskInfo taskInfo) { void _processReceiptGiver(TaskInfo taskInfo) {
Util.logInfo('Task ${taskInfo.task.sId} called');
showReceiptGiverPopup(context, taskInfo, (receiptGiver) { showReceiptGiverPopup(context, taskInfo, (receiptGiver) {
var answer = _createAnswerHeader(taskInfo); var answer = _createAnswerHeader(taskInfo);
answer.val = receiptGiver; answer.val = receiptGiver;
@@ -375,10 +387,13 @@ class _TaskListPageState extends State<TaskListPage> {
} }
void _processPickupDeliveryStatusTask(TaskInfo taskInfo) { void _processPickupDeliveryStatusTask(TaskInfo taskInfo) {
Util.logInfo('Task ${taskInfo.task.sId} called');
Future.delayed(const Duration(seconds: 1), () async { Future.delayed(const Duration(seconds: 1), () async {
showPickupDeliveryStatusPopup(context, taskInfo, (tourEntry) { showPickupDeliveryStatusPopup(context, taskInfo, (tourEntry, remark) {
var answer = _createAnswerHeader(taskInfo); var answer = _createAnswerHeader(taskInfo);
answer.code = tourEntry!.code; answer.code = tourEntry!.code;
answer.val = remark;
taskInfo.answer = jsonEncode(answer.toJson()); taskInfo.answer = jsonEncode(answer.toJson());
taskInfo.additionalText = tourEntry.text; taskInfo.additionalText = tourEntry.text;
@@ -392,6 +407,8 @@ class _TaskListPageState extends State<TaskListPage> {
} }
void _processSignature(TaskInfo taskInfo) { void _processSignature(TaskInfo taskInfo) {
Util.logInfo('Task ${taskInfo.task.sId} called');
MyApp.suppressAcceptDialog = true; MyApp.suppressAcceptDialog = true;
SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft]); SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft]);
@@ -407,6 +424,7 @@ class _TaskListPageState extends State<TaskListPage> {
answer.sign = signature; answer.sign = signature;
taskInfo.answer = jsonEncode(answer.toJson()); taskInfo.answer = jsonEncode(answer.toJson());
taskInfo.additionalText = "Unterschrift erfasst";
taskInfo.completed = true; taskInfo.completed = true;
_sendFinTourMessage(); _sendFinTourMessage();
+18 -1
View File
@@ -39,9 +39,24 @@ void showInfosPopup(BuildContext context, SessionStatus? status) async {
shadowColor: Colors.transparent, shadowColor: Colors.transparent,
backgroundColor: Colors.white, backgroundColor: Colors.white,
content: StatefulBuilder(builder: (BuildContext context, StateSetter setState) { 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"; var text = "Versionsnummer: a$version\n";
text += "Verbindungsstatus: $connectedString\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 += "\n";
text += "User Status:\n"; text += "User Status:\n";
if (status != null) { if (status != null) {
@@ -103,3 +118,5 @@ void showInfosPopup(BuildContext context, SessionStatus? status) async {
}))); })));
}); });
} }
+37 -46
View File
@@ -5,50 +5,41 @@ import 'package:stadtbote/tools/util.dart';
showTaskArrivedPopup(BuildContext context, TaskInfo taskInfo, Function() onFinished) async { showTaskArrivedPopup(BuildContext context, TaskInfo taskInfo, Function() onFinished) async {
await showDialog( await showDialog(
context: context, context: context,
builder: (BuildContext context) builder: (BuildContext context) {
{ return WillPopScope(
return AlertDialog( onWillPop: () async {
contentPadding: EdgeInsets.zero, return await taskDialogSecurityException(context);
shadowColor: Colors.transparent, }, // False will prevent and true will allow to dismiss
backgroundColor: Colors.white, child: AlertDialog(
content: StatefulBuilder(builder: (BuildContext context, StateSetter setState) { contentPadding: EdgeInsets.zero,
return SizedBox( shadowColor: Colors.transparent,
key: GlobalKey(), backgroundColor: Colors.white,
height: MediaQuery content: StatefulBuilder(builder: (BuildContext context, StateSetter setState) {
.of(context) return SizedBox(
.size key: GlobalKey(),
.height * 0.2, height: MediaQuery.of(context).size.height * 0.2,
width: MediaQuery width: MediaQuery.of(context).size.width * 0.8,
.of(context) child: Container(
.size height: 100,
.width * 0.8, decoration: BoxDecoration(
child: Container( borderRadius: BorderRadius.circular(10),
height: 100, color: Colors.white,
decoration: BoxDecoration( border: Border.all(
borderRadius: BorderRadius.circular(10), color: Colors.grey,
color: Colors.white, width: 0.5,
border: Border.all( ),
color: Colors.grey, ),
width: 0.5, child: Padding(
), padding: const EdgeInsets.all(35.0),
), child: Column(
child: Padding( children: [
padding: const EdgeInsets.all(35.0), Text(taskInfo.task.topic),
child: Column( const SizedBox(height: 20),
children: [ getDefaultButton(taskInfo.task.topic, () => {Navigator.of(context).pop(), onFinished()}),
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( await showDialog(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return WillPopScope(
contentPadding: EdgeInsets.zero, onWillPop: () async {
shadowColor: Colors.transparent, return await taskDialogSecurityException(context);
backgroundColor: Colors.white, },
content: StatefulBuilder(builder: (BuildContext context, StateSetter setState) { child: AlertDialog(
TextEditingController textEditingController = TextEditingController(); contentPadding: EdgeInsets.zero,
shadowColor: Colors.transparent,
backgroundColor: Colors.white,
content: StatefulBuilder(builder: (BuildContext context, StateSetter setState) {
TextEditingController textEditingController = TextEditingController();
return SizedBox( return SizedBox(
key: GlobalKey(), key: GlobalKey(),
height: 260, height: 260,
width: MediaQuery.of(context).size.width * 0.8, width: MediaQuery.of(context).size.width * 0.8,
child: Container( child: Container(
height: 100, height: 100,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
color: Colors.white, color: Colors.white,
border: Border.all( border: Border.all(
color: Colors.grey, color: Colors.grey,
width: 0.5, width: 0.5,
), ),
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.all(35.0), padding: const EdgeInsets.all(35.0),
child: Column( child: Column(
children: [ children: [
const Text('Bitte geben Sie die Kommisionsnummer ein'), const Text('Bitte geben Sie die Kommisionsnummer ein'),
const SizedBox(height: 20), const SizedBox(height: 20),
Util.getDefaultTextField('Kommisionsnummer', Util.getDefaultTextField('Kommisionsnummer',
textInputType: TextInputType.text, textInputType: TextInputType.text,
formatter: [FilteringTextInputFormatter.singleLineFormatter], formatter: [FilteringTextInputFormatter.singleLineFormatter],
controller: textEditingController, controller: textEditingController,
autofocus: true), autofocus: true),
const SizedBox(height: 20), const SizedBox(height: 20),
getDefaultButton('Übernehmen', () => { getDefaultButton('Übernehmen', () => {Navigator.of(context).pop(), onFinished(textEditingController.text)})
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/model/tour_task.dart';
import 'package:stadtbote/tools/util.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 = []; List<DropdownMenuEntry<TourEntry>> entries = [];
for (var entry in taskInfo.task.entries!) { for (var entry in taskInfo.task.entries!) {
var dropdownMenuEntry = DropdownMenuEntry<TourEntry>(value: entry, label: entry.text); var dropdownMenuEntry = DropdownMenuEntry<TourEntry>(value: entry, label: entry.text);
@@ -16,8 +16,13 @@ showPickupDeliveryStatusPopup(BuildContext context, TaskInfo taskInfo, Function(
TourEntry? selectedTourEntry; TourEntry? selectedTourEntry;
TextEditingController controller = TextEditingController(); TextEditingController controller = TextEditingController();
TextEditingController remController = TextEditingController();
return AlertDialog( return WillPopScope(
onWillPop: () async {
return await taskDialogSecurityException(context);
},
child: AlertDialog(
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
shadowColor: Colors.transparent, shadowColor: Colors.transparent,
backgroundColor: Colors.white, backgroundColor: Colors.white,
@@ -55,18 +60,28 @@ showPickupDeliveryStatusPopup(BuildContext context, TaskInfo taskInfo, Function(
dropdownMenuEntries: entries, dropdownMenuEntries: entries,
), ),
const SizedBox(height: 20), 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), const SizedBox(height: 20),
getDefaultButton('Übernehmen', buttonHeight: 50, () => { 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( await showDialog(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return WillPopScope(
onWillPop: () async {
return await taskDialogSecurityException(context);
},
child: AlertDialog(
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
shadowColor: Colors.transparent, shadowColor: Colors.transparent,
backgroundColor: Colors.white, 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( await showDialog(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return WillPopScope(
onWillPop: () async {
return await taskDialogSecurityException(context);
},
child: AlertDialog(
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
shadowColor: Colors.transparent, shadowColor: Colors.transparent,
backgroundColor: Colors.white, backgroundColor: Colors.white,
@@ -93,6 +97,6 @@ showScanBarcodesPopup(BuildContext context, TaskInfo taskInfo, Function(List<Str
), ),
), ),
)); ));
})); })));
}); });
} }
+65 -69
View File
@@ -9,82 +9,78 @@ showSignaturePopup(BuildContext context, TaskInfo taskInfo, Function(String?) on
builder: (BuildContext context) { builder: (BuildContext context) {
return WillPopScope( return WillPopScope(
onWillPop: () async { 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; String convertPoints(List<Point> points) {
},// False will prevent and true will allow to dismiss if (points.isNotEmpty) {
child: AlertDialog( String result = "";
contentPadding: EdgeInsets.zero,
shadowColor: Colors.transparent,
backgroundColor: Colors.white,
content: StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
final SignatureController controller = SignatureController();
var popupHeight = MediaQuery.of(context).size.height * 0.85; for (var point in points) {
var popupWidth = MediaQuery.of(context).size.width * 0.85; if (point.type != PointType.tap) {
result += "${point.offset.dx.toInt()},${point.offset.dy.toInt()};";
} else {
result += "A";
}
}
String convertPoints(List<Point> points) { return result.replaceAll("AA", "A");
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 "";
} }
return result.replaceAll("AA", "A"); return SizedBox(
} key: GlobalKey(),
height: popupHeight,
return ""; width: popupWidth,
} child: Container(
decoration: BoxDecoration(
return SizedBox( borderRadius: BorderRadius.circular(10),
key: GlobalKey(), color: Colors.white,
height: popupHeight, border: Border.all(
width: popupWidth, color: Colors.grey,
child: Container( width: 0.5,
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,
),
), ),
getDefaultButton('Übernehmen', buttonHeight: 50, () => { ),
if (controller.points.length > 50) { child: Padding(
Navigator.of(context).pop(), padding: const EdgeInsets.all(20.0),
child: Column(
onFinished(convertPoints(controller.points)) children: [
} else { Text(taskInfo.task.topic),
showAlertDialog(context, "Fehler", "Die Unterschrift ist zu kurz.") 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( await showDialog(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return WillPopScope(
onWillPop: () async {
return await taskDialogSecurityException(context);
},
child: AlertDialog(
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
shadowColor: Colors.transparent, shadowColor: Colors.transparent,
backgroundColor: Colors.white, backgroundColor: Colors.white,
@@ -52,7 +56,7 @@ showStationNoticePopup(BuildContext context, TaskInfo taskInfo, Function(String)
), ),
), ),
)); ));
})); })));
}, },
); );
} }
+34 -8
View File
@@ -9,12 +9,18 @@ Future<void> showTakePhotosPopup(BuildContext context, TaskInfo taskInfo, Functi
List<Uint8List> imageDataList = []; List<Uint8List> imageDataList = [];
List<Widget> imageWidgetsList = []; List<Widget> imageWidgetsList = [];
int currentCarousselSliderIndex = 0;
ValueNotifier<List<Widget>> imageWidgetsListNotifier = ValueNotifier<List<Widget>>([]); ValueNotifier<List<Widget>> imageWidgetsListNotifier = ValueNotifier<List<Widget>>([]);
await showDialog( await showDialog(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return WillPopScope(
onWillPop: () async {
return await taskDialogSecurityException(context);
},
child: AlertDialog(
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
shadowColor: Colors.transparent, shadowColor: Colors.transparent,
backgroundColor: Colors.white, backgroundColor: Colors.white,
@@ -39,7 +45,24 @@ Future<void> showTakePhotosPopup(BuildContext context, TaskInfo taskInfo, Functi
imageWidgetsList.add(GestureDetector( imageWidgetsList.add(GestureDetector(
onTap: () {}, 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; imageWidgetsListNotifier.value = imageWidgetsList;
@@ -86,11 +109,14 @@ Future<void> showTakePhotosPopup(BuildContext context, TaskInfo taskInfo, Functi
valueListenable: imageWidgetsListNotifier, valueListenable: imageWidgetsListNotifier,
builder: (context, value, child) { builder: (context, value, child) {
return CarouselSlider( return CarouselSlider(
options: CarouselOptions( options: CarouselOptions(
disableCenter: false, disableCenter: false,
enableInfiniteScroll: false, enableInfiniteScroll: false,
), onPageChanged: (index, reason) {
items: imageWidgetsList.toList()); currentCarousselSliderIndex = index;
},
),
items: imageWidgetsList.toList());
}, },
), ),
), ),
@@ -112,6 +138,6 @@ Future<void> showTakePhotosPopup(BuildContext context, TaskInfo taskInfo, Functi
), ),
), ),
)); ));
})); })));
}); });
} }
+6 -2
View File
@@ -5,7 +5,11 @@ showZipPopup(BuildContext context, String text, String buttonText, Function(Stri
await showDialog( await showDialog(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return WillPopScope(
onWillPop: () async {
return await taskDialogSecurityException(context);
},
child: AlertDialog(
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
shadowColor: Colors.transparent, shadowColor: Colors.transparent,
backgroundColor: Colors.white, backgroundColor: Colors.white,
@@ -48,7 +52,7 @@ showZipPopup(BuildContext context, String text, String buttonText, Function(Stri
), ),
), ),
)); ));
})); })));
}); });
} }
+6 -6
View File
@@ -165,14 +165,16 @@ class MqttCore {
try { try {
final MqttPublishMessage message = mqttMessage.payload as MqttPublishMessage; 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 topicArray = message.variableHeader?.topicName;
var topicArraySplited = topicArray!.split("/"); var topicArraySplited = topicArray!.split("/");
var topic = topicArraySplited[6]; 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) { switch (topic) {
case 'session': case 'session':
@@ -347,8 +349,6 @@ class MqttCore {
await Util.playMp3('asbeep.mp3'); await Util.playMp3('asbeep.mp3');
MessageService().publish<MessageReceivedMessage>(Constants.messageTopicMessageReceived, arguments: MessageReceivedMessage(message: newMessage)); MessageService().publish<MessageReceivedMessage>(Constants.messageTopicMessageReceived, arguments: MessageReceivedMessage(message: newMessage));
} }
+29 -1
View File
@@ -360,6 +360,19 @@ String mapTourMode(String mode) {
return text; 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 { Future<void> showAlertDialog(BuildContext context, String title, String message) async {
await showDialog( await showDialog(
context: context, context: context,
@@ -406,4 +419,19 @@ class DecimalTextInputFormatter extends TextInputFormatter {
bool isJobInFuture(Job job) { bool isJobInFuture(Job job) {
return DateTime.parse(job.ordertime).add(Duration(minutes: job.offsWarn)).toUtc().millisecondsSinceEpoch > DateTime.now().toUtc().millisecondsSinceEpoch; 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;
}
+1 -1
View File
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 309.0.0+309 version: 312.0.0+312
environment: environment:
sdk: '>=2.19.6 <3.0.0' sdk: '>=2.19.6 <3.0.0'