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

+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
));
})));
});
}
}*/