Fehlerkorrekturen und Erweiterungen

This commit is contained in:
Sven committed 2025-03-03 14:29:35 +01:00
1 parent 777876bc8d
commit 1f3cc1e995
357 files changed
+50603 -572

No files matched your search

+9 -3
View File
@@ -1,9 +1,9 @@
import 'package:dart_mq/dart_mq.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart' show DateFormat;
import 'package:isar/isar.dart';
import 'package:stadtbote/content_views/tour_list_page.dart';
import 'package:stadtbote/content_views/utils/content_view_widget.dart';
import 'package:intl/intl.dart';
import 'package:stadtbote/messages/pop_content_view_message.dart';
import '../main.dart';
@@ -57,8 +57,14 @@ class _AcceptedJobsPageState extends State<AcceptedJobsPage> with ProducerMixin
late List<Widget> jobWidgets = _createjobWidgets();
return ListView(
children: jobWidgets
return Padding(
padding: const EdgeInsets.all(8.0),
child: Scrollbar(
thumbVisibility: true,
child: ListView(
children: jobWidgets
),
),
);
}
+7 -12
View File
@@ -60,19 +60,16 @@ class _AssignedJobsPageState extends State<AssignedJobsPage> with ProducerMixin,
return Util.getWaitWidget(context);
}
var widgets = _createWidgets();
var jobWidgets = _createWidgets();
return Container(
height: 100,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.white,
border: Border.all(
color: Colors.grey,
width: 0.5,
return Padding(
padding: const EdgeInsets.all(8.0),
child: Scrollbar(
thumbVisibility: true,
child: ListView(
children: jobWidgets
),
),
child: SingleChildScrollView(child: Column(children: widgets)),
);
}
@@ -202,8 +199,6 @@ class _AssignedJobsPageState extends State<AssignedJobsPage> with ProducerMixin,
_jobs.removeWhere((databaseJob) => databaseJob.id == job.id);
print("test:" + _jobs.length.toString());
setState(() {});
}),
)
+8 -2
View File
@@ -51,8 +51,14 @@ class _FinishedJobsPageState extends State<FinishedJobsPage> with ProducerMixin
late List<Widget> jobWidgets = _createjobWidgets();
return ListView(
children: jobWidgets
return Padding(
padding: const EdgeInsets.all(8.0),
child: Scrollbar(
thumbVisibility: true,
child: ListView(
children: jobWidgets
),
),
);
}
+4 -4
View File
@@ -18,7 +18,6 @@ import 'package:stadtbote/popups/tasks_popups/arrived_popup.dart';
import 'package:stadtbote/popups/tasks_popups/commision_number_popup.dart';
import 'package:stadtbote/popups/tasks_popups/pickup_delivery_status_popup.dart';
import 'package:stadtbote/popups/tasks_popups/receipt_giver_popup.dart';
import 'package:stadtbote/popups/tasks_popups/scan_barcodes_popup.dart';
import 'package:stadtbote/popups/tasks_popups/signature_popup.dart';
import 'package:stadtbote/popups/tasks_popups/station_notice_popup.dart';
import 'package:stadtbote/popups/tasks_popups/take_photos_popup.dart';
@@ -231,7 +230,8 @@ class _TaskListPageState extends State<TaskListPage> with ProducerMixin {
break;
case 5:
_processScanBarcodes(taskInfo);
// 26.02.2025 Nach Abstimmung mit Gunnar entfernt
//_processScanBarcodes(taskInfo);
break;
case 7:
@@ -291,7 +291,7 @@ class _TaskListPageState extends State<TaskListPage> with ProducerMixin {
});
}
_processScanBarcodes(TaskInfo taskInfo) {
/*_processScanBarcodes(TaskInfo taskInfo) {
Util.logInfo('Task ${taskInfo.task.sId} called');
showScanBarcodesPopup(context, taskInfo, (List<String> barcodes) {
@@ -309,7 +309,7 @@ class _TaskListPageState extends State<TaskListPage> with ProducerMixin {
_finishTaskProcessing(taskInfo);
});
}
}*/
_processTakePhotos(TaskInfo taskInfo) {
Util.logInfo('Task ${taskInfo.task.sId} called');
+1 -1
View File
@@ -358,7 +358,7 @@ class _MainState extends State<Main> with SingleTickerProviderStateMixin, Produc
sendMessage(
routingKey: Constants.messageTopicJobDeleted,
payload: JobDeletedMessage(job: job!),
payload: JobDeletedMessage(job: job),
);
sendMessage(
+34 -83
View File
@@ -1,6 +1,7 @@
import 'dart:async';
import 'package:expandable/expandable.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:shared_map/shared_map.dart';
@@ -21,6 +22,8 @@ import '../tools/messages/publish_payload_message.dart';
late Map<int, bool> _infoExpandedMap;
final ScrollController _scrollController = ScrollController();
Future<void> showAcceptJobsPopup(SharedMapReference mapReference, Function() onFinished) async {
_infoExpandedMap = {};
@@ -38,10 +41,9 @@ Future<void> showAcceptJobsPopup(SharedMapReference mapReference, Function() onF
return SizedBox(
key: GlobalKey(),
height: 400,
width: MediaQuery.of(context).size.width * 1.2,
height: 370,
width: MediaQuery.of(context).size.width - 10,
child: Container(
height: 400,
padding: const EdgeInsets.all(5),
child: FutureBuilder<List<Widget>>(
future: _fetchJobWidgets(setState, onFinished, mapReference),
@@ -49,8 +51,13 @@ Future<void> showAcceptJobsPopup(SharedMapReference mapReference, Function() onF
if (snapshot.connectionState == ConnectionState.waiting) {
return Util.getWaitWidget(context);
} else {
return ListView(
children: snapshot.requireData,
return Scrollbar(
thumbVisibility: true,
controller: _scrollController,
child: ListView(
controller: _scrollController,
children: snapshot.requireData,
),
);
}
},
@@ -81,15 +88,6 @@ Future<void> showAcceptJobsPopup(SharedMapReference mapReference, Function() onF
widgets.add(extendedStatefulBuilder);
widgets.add(getDefaultButton("Liste schliessen", () {
extendedStatefulBuilder.unsubscribe(queueId: Constants.messageTopicJobReceived);
extendedStatefulBuilder.unsubscribe(queueId: Constants.messageTopicJobDeleted);
Navigator.pop(context);
onFinished();
}));
return Material(
color: Colors.transparent,
child: Stack(
@@ -100,9 +98,28 @@ Future<void> showAcceptJobsPopup(SharedMapReference mapReference, Function() onF
padding: const EdgeInsets.all(5),
height: 480,
color: Colors.white,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: widgets,
child: Padding(
padding: const EdgeInsets.all(30),
child: Column(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.all(2.0),
child: Scrollbar(
child: ListView(children: widgets),
),
),
),
getDefaultButton("Liste schliessen", () {
extendedStatefulBuilder.unsubscribe(queueId: Constants.messageTopicJobReceived);
extendedStatefulBuilder.unsubscribe(queueId: Constants.messageTopicJobDeleted);
Navigator.pop(context);
onFinished();
})
],
),
),
))
],
@@ -110,74 +127,8 @@ Future<void> showAcceptJobsPopup(SharedMapReference mapReference, Function() onF
);
},
);
/*await showDialog<void>(
context: MyApp.appNavigatorKey.currentContext!,
builder: (BuildContext context) {
return WillPopScope(
onWillPop: () async {
_stopTimer();
Navigator.of(context).pop();
onFinished();
return true;
},
child: AlertDialog(
contentPadding: EdgeInsets.zero,
shadowColor: Colors.transparent,
backgroundColor: Colors.white,
content: StatefulBuilder(builder: (BuildContext context, StateSetter setState) {
if (_initTimer) {
_initTimer = false;
_startTimer(context, mapReference, setState, onFinished);
}
return SizedBox(
key: GlobalKey(),
height: MediaQuery.of(context).size.height * 0.4,
width: MediaQuery.of(context).size.width * 1.2,
child: Container(
height: 100,
padding: const EdgeInsets.all(5),
child: FutureBuilder<List<Widget>>(
future: _fetchJobWidgets(setState, onFinished, mapReference),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return Util.getWaitWidget(context);
} else {
return ListView(
children: snapshot.requireData,
);
}
},
),
));
})));
});*/
}
/*void _startTimer(BuildContext context, SharedMapReference mapReference, StateSetter setState, Function() onFinished) {
_checkForNewJobsTimer = Timer.periodic(const Duration(seconds: 5), (Timer t) async {
var jobMap = SharedMap<int, Job>.fromSharedReference(mapReference);
if (await jobMap.length() > 0) {
setState(() {});
} else {
_stopTimer();
Navigator.of(MyApp.appNavigatorKey.currentContext!).pop();
onFinished();
}
});
}*/
/*void _stopTimer() {
_checkForNewJobsTimer.cancel();
}*/
Future<List<Widget>> _fetchJobWidgets(StateSetter dialogState, Function() onFinished, SharedMapReference mapReference) async {
List<Widget> widgets = [];
+25 -18
View File
@@ -8,6 +8,8 @@ import 'package:stadtbote/tools/util.dart';
import '../model/job_tour.dart';
List<Color> _colors = [Colors.red, Colors.green];
showMapPopup(BuildContext context, JobTour currentTour, List<JobTour> tourList) async {
await showDialog(
context: context,
@@ -29,7 +31,7 @@ showMapPopup(BuildContext context, JobTour currentTour, List<JobTour> tourList)
GestureDetector(
onTap: () async {
if (tour.pos != null) {
mapController.move(LatLng(tour.pos!.lat, tour.pos!.long), mapController.zoom);
mapController.move(LatLng(tour.pos!.lat, tour.pos!.long), mapController.camera.zoom);
streamController[currentTour.sort]!.sink.add(false);
@@ -93,9 +95,12 @@ showMapPopup(BuildContext context, JobTour currentTour, List<JobTour> tourList)
List<Marker> markers = [];
for (var tour in tourList) {
if (tour.pos != null) {
markers.add(Marker(
builder: (context) => const Icon(Icons.person_pin_circle, size: 56, color: Colors.blue),
point: LatLng(tour.pos!.lat, tour.pos!.long)));
markers.add(Marker(
point: LatLng(tour.pos!.lat, tour.pos!.long),
width: 56,
height: 56,
child: const Icon(Icons.person_pin_circle, size: 56, color: Colors.blue),
));
}
}
@@ -137,23 +142,25 @@ showMapPopup(BuildContext context, JobTour currentTour, List<JobTour> tourList)
current: value,
first: true,
second: false,
dif: 0.0,
borderColor: Colors.transparent,
style: ToggleStyle(
borderColor: Colors.transparent,
boxShadow: const [
BoxShadow(
color: Colors.black26,
spreadRadius: 1,
blurRadius: 2,
offset: Offset(0, 1.5),
),
],
indicatorColor: Colors.red
),
borderWidth: 5.0,
height: 25,
boxShadow: const [
BoxShadow(
color: Colors.black26,
spreadRadius: 1,
blurRadius: 2,
offset: Offset(0, 1.5),
),
],
onChanged: (b) {
valueNotifier.value = b;
mapController.move(mapController.center, b ? 14.0 : 16.0);
mapController.move(mapController.camera.center, b ? 14.0 : 16.0);
},
colorBuilder: (b) => b ? Colors.red : Colors.green,
styleBuilder: (i) => ToggleStyle(indicatorColor: i == true ? _colors[0] : _colors[1]),
textBuilder: (value) => value ? const Center(child: Text('Fern')) : const Center(child: Text('Nah')),
);
},
@@ -168,8 +175,8 @@ showMapPopup(BuildContext context, JobTour currentTour, List<JobTour> tourList)
child: FlutterMap(
mapController: mapController,
options: MapOptions(
center: LatLng(currentTour.pos!.lat, currentTour.pos!.long),
zoom: 14,
//center: LatLng(currentTour.pos!.lat, currentTour.pos!.long),
//zoom: 14,
),
children: [
TileLayer(
@@ -1,10 +1,12 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
import 'package:stadtbote/model/task_info.dart';
import 'package:stadtbote/tools/util.dart';
// 26.02.2025 Nach Abstimmung mit Gunnar entfernt
showScanBarcodesPopup(BuildContext context, TaskInfo taskInfo, Function(List<String> barcodes) onFinished) async {
//import 'package:flutter/material.dart';
//import 'package:flutter/services.dart';
//import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
//import 'package:stadtbote/model/task_info.dart';
//import 'package:stadtbote/tools/util.dart';
/*showScanBarcodesPopup(BuildContext context, TaskInfo taskInfo, Function(List<String> barcodes) onFinished) async {
await showDialog(
context: context,
builder: (BuildContext context) {
@@ -99,4 +101,4 @@ showScanBarcodesPopup(BuildContext context, TaskInfo taskInfo, Function(List<Str
));
})));
});
}
}*/
@@ -1,5 +1,3 @@
import 'package:stadtbote/model/job.dart';
class RemoveState0JobFromMapMessage {
final int jobId;
+7 -7
View File
@@ -113,7 +113,7 @@ class MqttCore with ProducerMixin, ConsumerMixin {
_connectToBroker() async {
try {
String clientId = await Util.getAppUuid();
String clientId = Util.getAppUuid();
Util.logInfo("client id: $clientId");
Util.logInfo("broker uri: $_brokerUri");
Util.logInfo("broker port: $_brokerPort");
@@ -137,7 +137,7 @@ class MqttCore with ProducerMixin, ConsumerMixin {
var connectionLostEncapsulatedMessage = _encapsulateMessage(const Uuid().v4(), false, connectionLostMessage.toJson());
_mqttClient!.connectionMessage = MqttConnectMessage()
.withClientIdentifier(await Util.getAppUuid())
.withClientIdentifier(Util.getAppUuid())
.authenticateAs("app", "apppwd")
.withSessionExpiryInterval(2700)
.withWillProperties(willProperties)
@@ -281,8 +281,8 @@ class MqttCore with ProducerMixin, ConsumerMixin {
var fromServerTopic = "$_fromServerTopic$_clientId/#";
if (await Util.preferencesContainsKey(Constants.prefsPreviousMqttSubscription)) {
String previousMqttSubscription = await Util.preferencesGetString(Constants.prefsPreviousMqttSubscription, "") as String;
if (Util.preferencesContainsKey(Constants.prefsPreviousMqttSubscription)) {
String previousMqttSubscription = Util.preferencesGetString(Constants.prefsPreviousMqttSubscription, "") as String;
if (previousMqttSubscription != fromServerTopic) {
Util.logInfo('topic changed -> unsubscribe from $previousMqttSubscription');
@@ -417,7 +417,7 @@ class MqttCore with ProducerMixin, ConsumerMixin {
if (job != null) {
sendMessage(
routingKey: Constants.messageTopicJobDeleted,
payload: JobDeletedMessage(job: job!),
payload: JobDeletedMessage(job: job),
);
}
}
@@ -535,7 +535,7 @@ class MqttCore with ProducerMixin, ConsumerMixin {
var handshakeMessage = BootstrapRequest();
handshakeMessage.app = "sb";
handshakeMessage.mqttClientId = await Util.getAppUuid();
handshakeMessage.mqttClientId = Util.getAppUuid();
handshakeMessage.deviceObject = deviceObject;
handshakeMessage.ver = await Util.getAppVersion();
@@ -577,7 +577,7 @@ class MqttCore with ProducerMixin, ConsumerMixin {
_initSession() async {
var startSessionMessage = StartSessionMessage();
startSessionMessage.desiredZip = (await Util.preferencesGetString(Constants.prefsDesiredZip, ""))!;
startSessionMessage.desiredZip = (Util.preferencesGetString(Constants.prefsDesiredZip, ""))!;
var jsonMap = startSessionMessage.toJson();