Fehlerkorrekturen und Erweiterungen

This commit is contained in:
Sven committed 2025-02-24 09:21:29 +01:00
1 parent 3fd8b0f9d4
commit 777876bc8d
8 files changed
+70 -45

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

+2 -3
View File
@@ -67,10 +67,9 @@ class _AcceptedJobsPageState extends State<AcceptedJobsPage> with ProducerMixin
for (var job in _jobs) { for (var job in _jobs) {
var bottomText = "${job.id}\n${job.tours[0].comp}\n${job.tours[0].street}\n${job.tours[0].city}"; var bottomText = "${job.id}\n${job.tours[0].comp}\n${job.tours[0].street}\n${job.tours[0].city}";
// BWV if (job.rem.trim().isNotEmpty) {
/*if (job.rem.trim().isNotEmpty) {
bottomText += "\n\n${job.rem.trim()}"; bottomText += "\n\n${job.rem.trim()}";
}*/ }
jobWidgets.add( jobWidgets.add(
ListTile( ListTile(
+10
View File
@@ -124,6 +124,16 @@ class _AssignedJobsPageState extends State<AssignedJobsPage> with ProducerMixin,
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: TextStyle(backgroundColor: isJobTooFarInFuture(job) ? Colors.red : Colors.white), style: TextStyle(backgroundColor: isJobTooFarInFuture(job) ? Colors.red : Colors.white),
), ),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset("assets/${mapVehicleTypeToImageName(job.vhtId)}", width: 60, height: 60),
const SizedBox(width: 10),
Text(
mapVehicleTypeToText(job.vhtId)
),
],
),
Text('Auftragsnummer: ${job.id}'), Text('Auftragsnummer: ${job.id}'),
Text(job.tours[0].comp), Text(job.tours[0].comp),
Text(job.tours[0].street), Text(job.tours[0].street),
+4 -5
View File
@@ -6,6 +6,7 @@ import 'package:stadtbote/content_views/approach_area_page.dart';
import 'package:stadtbote/content_views/assigned_jobs_page.dart'; import 'package:stadtbote/content_views/assigned_jobs_page.dart';
import 'package:stadtbote/content_views/finished_jobs_page.dart'; import 'package:stadtbote/content_views/finished_jobs_page.dart';
import 'package:stadtbote/content_views/messages_page.dart'; import 'package:stadtbote/content_views/messages_page.dart';
import 'package:stadtbote/content_views/set_desired_zip_page.dart';
import 'package:stadtbote/content_views/utils/content_view_widget.dart'; import 'package:stadtbote/content_views/utils/content_view_widget.dart';
import 'package:stadtbote/main.dart'; import 'package:stadtbote/main.dart';
import 'package:stadtbote/model/job.dart'; import 'package:stadtbote/model/job.dart';
@@ -219,21 +220,19 @@ class _MainPageState extends State<MainPage> with ConsumerMixin, ProducerMixin {
//await MessageService().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const ApproachAreaPage()) //await MessageService().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const ApproachAreaPage())
}), }),
), ),
/*SizedBox(height: _loggedOut == true ? 0 : 20), SizedBox(height: _loggedOut == true ? 0 : 20),
Visibility( Visibility(
visible: !_loggedOut, visible: !_loggedOut,
child: getDefaultButton( child: getDefaultButton(
'Wunschziel für heute', 'Wunschziel für heute',
image: Image.asset('assets/anfahrtsbereich.png', width: 30, height: 30), image: Image.asset('assets/wunsch_plz.png', width: 30, height: 30),
() async => { () async => {
// TODO MESSAGING
sendMessage( sendMessage(
routingKey: Constants.messageTopicPushContentView, routingKey: Constants.messageTopicPushContentView,
payload: const SetDesiredZipPage(), payload: const SetDesiredZipPage(),
) )
//await MessageService().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const ApproachAreaPage())
}), }),
),*/ ),
SizedBox(height: _loggedOut == true ? 0 : 20), SizedBox(height: _loggedOut == true ? 0 : 20),
getDefaultButton(_loggedOut ? 'Anmelden' : 'Abmelden', getDefaultButton(_loggedOut ? 'Anmelden' : 'Abmelden',
image: Image.asset(_loggedOut ? 'assets/anmelden.png' : 'assets/abmelden.png', width: 30, height: 30), () async { image: Image.asset(_loggedOut ? 'assets/anmelden.png' : 'assets/abmelden.png', width: 30, height: 30), () async {
+23 -9
View File
@@ -28,6 +28,11 @@ class _SetDesiredZipPageState extends State<SetDesiredZipPage> with ProducerMixi
@override @override
void initState() { void initState() {
var savedDesiredZip = Util.preferencesGetString(Constants.prefsDesiredZip, null);
if (savedDesiredZip != null) {
textEditController.text = savedDesiredZip;
}
super.initState(); super.initState();
} }
@@ -47,8 +52,13 @@ class _SetDesiredZipPageState extends State<SetDesiredZipPage> with ProducerMixi
width: 120, // Festlegen der Breite des Textfelds width: 120, // Festlegen der Breite des Textfelds
child: child:
Util.getDefaultTextField('PLZ', Util.getDefaultTextField('PLZ',
textInputType: TextInputType.text, textInputType: TextInputType.number,
formatter: [FilteringTextInputFormatter.singleLineFormatter], formatter: [
// Erlaubt nur Ziffern
FilteringTextInputFormatter.digitsOnly,
// Begrenzt die maximale Eingabelänge auf 5 Zeichen
LengthLimitingTextInputFormatter(5),
],
controller: textEditController, controller: textEditController,
maxLength: 5, maxLength: 5,
autofocus: true autofocus: true
@@ -59,14 +69,18 @@ class _SetDesiredZipPageState extends State<SetDesiredZipPage> with ProducerMixi
const SizedBox(height: 20), const SizedBox(height: 20),
getDefaultButton('Übernehmen', () => getDefaultButton('Übernehmen', () =>
{ {
Util.preferencesSaveString(Constants.prefsDesiredZip, textEditController.text), if (textEditController.text.isEmpty || textEditController.text.length == 5) {
Util.preferencesSaveString(Constants.prefsDesiredZip, textEditController.text),
_sendDesiredZipMessage(textEditController.text), _sendDesiredZipMessage(textEditController.text),
sendMessage( sendMessage(
routingKey: Constants.messageTopicPopContentView, routingKey: Constants.messageTopicPopContentView,
payload: PopContentViewMessage(count: 1), payload: PopContentViewMessage(count: 1),
) )
} else {
showAlertDialog("Fehler", "Das Feld muss leer sein, oder es müssen fünf Zahlen eingegeben werden")
}
}) })
] ]
), ),
@@ -79,7 +93,7 @@ class _SetDesiredZipPageState extends State<SetDesiredZipPage> with ProducerMixi
sendMessage( sendMessage(
routingKey: Constants.messageTopicPublishPayload, routingKey: Constants.messageTopicPublishPayload,
payload: PublishPayloadMessage(topic: "set_desired_zip", message: desiredZipMessage.toJson(),acknowledgeRequired: true), payload: PublishPayloadMessage(topic: "set_desired_zip", message: desiredZipMessage.toJson(), acknowledgeRequired: true),
); );
} }
} }
+15 -11
View File
@@ -36,6 +36,8 @@ Future<void> main() async {
runZonedGuarded(() async { runZonedGuarded(() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
await Util.init();
MQClient.initialize(); MQClient.initialize();
MQClient.instance.declareQueue(Constants.messageTopicRemoveJob); MQClient.instance.declareQueue(Constants.messageTopicRemoveJob);
MQClient.instance.declareQueue(Constants.messageTopicPublishPayload); MQClient.instance.declareQueue(Constants.messageTopicPublishPayload);
@@ -349,19 +351,21 @@ class _MainState extends State<Main> with SingleTickerProviderStateMixin, Produc
var job = await MyApp.isarInstance.jobs.where().filter().idEqualTo(removeJobMessage.id).findFirst(); var job = await MyApp.isarInstance.jobs.where().filter().idEqualTo(removeJobMessage.id).findFirst();
await MyApp.isarInstance.writeTxn(() async { if (job != null) {
await MyApp.isarInstance.jobs.where().filter().idEqualTo(removeJobMessage.id).deleteAll(); await MyApp.isarInstance.writeTxn(() async {
}); await MyApp.isarInstance.jobs.where().filter().idEqualTo(removeJobMessage.id).deleteAll();
});
sendMessage( sendMessage(
routingKey: Constants.messageTopicJobDeleted, routingKey: Constants.messageTopicJobDeleted,
payload: JobDeletedMessage(job: job!), payload: JobDeletedMessage(job: job!),
); );
sendMessage( sendMessage(
routingKey: Constants.messageTopicUpdateBadges, routingKey: Constants.messageTopicUpdateBadges,
payload: RefreshBadgesMessage, payload: RefreshBadgesMessage,
); );
}
}, },
); );
+15 -16
View File
@@ -16,19 +16,22 @@ import 'package:uuid/uuid.dart';
import '../Tools/colored_safe_area.dart'; import '../Tools/colored_safe_area.dart';
class Util { class Util {
static Future<bool> preferencesContainsKey(String key) async { static late SharedPreferences prefs;
var prefs = await SharedPreferences.getInstance();
static init() async {
prefs = await SharedPreferences.getInstance();
}
static bool preferencesContainsKey(String key) {
return prefs.containsKey(key); return prefs.containsKey(key);
} }
static void preferencesSaveString(String key, String value) async { static void preferencesSaveString(String key, String value) async {
var prefs = await SharedPreferences.getInstance();
await prefs.setString(key, value); await prefs.setString(key, value);
} }
static Future<String?> preferencesGetString(String key, String? defaultValue) async { static String? preferencesGetString(String key, String? defaultValue) {
if (await preferencesContainsKey(key)) { if (preferencesContainsKey(key)) {
var prefs = await SharedPreferences.getInstance();
return prefs.getString(key); return prefs.getString(key);
} }
@@ -36,13 +39,11 @@ class Util {
} }
static void preferencesSaveInt(String key, int value) async { static void preferencesSaveInt(String key, int value) async {
var prefs = await SharedPreferences.getInstance();
await prefs.setInt(key, value); await prefs.setInt(key, value);
} }
static Future<int?> preferencesGetInt(String key, int? defaultValue) async { static int? preferencesGetInt(String key, int? defaultValue) {
if (await preferencesContainsKey(key)) { if (preferencesContainsKey(key)) {
var prefs = await SharedPreferences.getInstance();
return prefs.getInt(key); return prefs.getInt(key);
} }
@@ -50,21 +51,19 @@ class Util {
} }
static void preferencesSaveBool(String key, bool value) async { static void preferencesSaveBool(String key, bool value) async {
var prefs = await SharedPreferences.getInstance();
await prefs.setBool(key, value); await prefs.setBool(key, value);
} }
static Future<bool> preferencesGetBool(String key, bool defaultValue) async { static bool preferencesGetBool(String key, bool defaultValue) {
if (await preferencesContainsKey(key)) { if (preferencesContainsKey(key)) {
var prefs = await SharedPreferences.getInstance();
return prefs.getBool(key) as bool; return prefs.getBool(key) as bool;
} }
return defaultValue; return defaultValue;
} }
static Future<String> getAppUuid() async { static String getAppUuid() {
var currentUuid = await preferencesGetString('uuid', null); var currentUuid = preferencesGetString('uuid', null);
if (currentUuid == null) { if (currentUuid == null) {
currentUuid ??= const Uuid().v4(); currentUuid ??= const Uuid().v4();
+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: 332.0.0+332 version: 335.0.0+335
environment: environment:
sdk: '>=2.19.6 <3.0.0' sdk: '>=2.19.6 <3.0.0'