Erweiterungen

This commit is contained in:
Sven committed 2024-02-08 09:59:31 +01:00
1 parent 3c2e9ceecb
commit 85d6d49258
16 files changed
+98 -77

No files matched your search

Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -24,7 +24,7 @@ class AcceptedJobsPage extends ContentViewWidget {
'Angenommene Aufträge',
style: TextStyle(
color: Colors.white,
fontSize: 24.0,
fontSize: 20.0,
),
),
rightButtonEnabled: false,
+2 -3
View File
@@ -3,7 +3,6 @@ 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:stadtbote/content_views/utils/header_info.dart';
import 'package:intl/intl.dart';
import 'package:stadtbote/tools/message_service.dart';
import '../main.dart';
@@ -24,12 +23,12 @@ class ApproachAreaPage extends ContentViewWidget {
'Angenommene Aufträge',
style: TextStyle(
color: Colors.white,
fontSize: 24.0,
fontSize: 20.0,
),
),
rightButtonEnabled: true,
rightButtonVisible: true,
rightButtonImage: Util.fetchFutureIcon(const Icon(Icons.info_outline, size: 20.0, color: Colors.white)),
rightButtonImage: Util.fetchFutureIcon(const Icon(Icons.help_outline, size: 20.0, color: Colors.white)),
rightButtonOnPressed: () async {
await Util.startBrowser('https://app.assecutor.de/help/sb/app/context/001/index.html');
});
+1 -1
View File
@@ -27,7 +27,7 @@ class AssignedJobsPage extends ContentViewWidget {
'Zugewiesene Aufträge',
style: TextStyle(
color: Colors.white,
fontSize: 24.0,
fontSize: 20.0,
),
),
rightButtonEnabled: false,
+1 -1
View File
@@ -24,7 +24,7 @@ class FinishedJobsPage extends ContentViewWidget {
'Erledigte Aufträge',
style: TextStyle(
color: Colors.white,
fontSize: 24.0,
fontSize: 20.0,
),
),
rightButtonEnabled: false,
-16
View File
@@ -235,22 +235,6 @@ class _MainPageState extends State<MainPage> {
);
}
/*_test() async {
var json = await rootBundle.loadString('assets/job.json');
var jsonMap = jsonDecode(json);
var payload = jsonMap["payload"];
var jobsPayload = JobsPayload.fromJson(payload);
if (jobsPayload.jobs != null) {
MyApp.isarInstance.writeTxnSync(() {
for (var job in jobsPayload.jobs as List<Job>) {
MyApp.isarInstance.jobs.putSync(job);
}
});
}
}*/
_initMessages() {
MessageService().subscribe<StatusInfoUpdate>(Constants.messageTopicStatusInfoUpdate, this, (statusInfoUpdateMessage) {
widget.sidValueNotifier.value = statusInfoUpdateMessage.status.sid;
+2 -2
View File
@@ -26,12 +26,12 @@ class MessagesPage extends ContentViewWidget {
'Nachrichten',
style: TextStyle(
color: Colors.white,
fontSize: 24.0,
fontSize: 20.0,
),
),
rightButtonEnabled: true,
rightButtonVisible: true,
rightButtonImage: Util.fetchFutureIcon(const Icon(Icons.info_outline, size: 20.0, color: Colors.white)),
rightButtonImage: Util.fetchFutureIcon(const Icon(Icons.help_outline, size: 20.0, color: Colors.white)),
rightButtonOnPressed: () async {
await Util.startBrowser('https://app.assecutor.de/help/sb/app/context/003/index.html');
});
+2 -2
View File
@@ -43,12 +43,12 @@ class TaskListPage extends ContentViewWidget {
'Liste der Aufgaben',
style: TextStyle(
color: Colors.white,
fontSize: 24.0,
fontSize: 20.0,
),
),
rightButtonEnabled: true,
rightButtonVisible: true,
rightButtonImage: Util.fetchFutureIcon(const Icon(Icons.info_outline, size: 20.0, color: Colors.white)),
rightButtonImage: Util.fetchFutureIcon(const Icon(Icons.help_outline, size: 20.0, color: Colors.white)),
rightButtonOnPressed: () async {
await Util.startBrowser('https://app.assecutor.de/help/sb/app/context/002/index.html');
});
+1 -1
View File
@@ -29,7 +29,7 @@ class TourDetailsPage extends ContentViewWidget {
'Details der Station',
style: TextStyle(
color: Colors.white,
fontSize: 24.0,
fontSize: 20.0,
),
),
rightButtonEnabled: false,
+2 -2
View File
@@ -27,12 +27,12 @@ class TourListPage extends ContentViewWidget {
'Liste der Stationen',
style: TextStyle(
color: Colors.white,
fontSize: 24.0,
fontSize: 20.0,
),
),
rightButtonEnabled: true,
rightButtonVisible: true,
rightButtonImage: Util.fetchFutureIcon(const Icon(Icons.info_outline, size: 20.0, color: Colors.white)),
rightButtonImage: Util.fetchFutureIcon(const Icon(Icons.help_outline, size: 20.0, color: Colors.white)),
rightButtonOnPressed: () async {
await Util.startBrowser('https://app.assecutor.de/help/sb/app/context/004/index.html');
});
+13 -11
View File
@@ -144,7 +144,7 @@ class MqttCore {
_mqttClient.updates?.listen((List<MqttReceivedMessage<MqttMessage>> c) {
try {
final MqttPublishMessage message = c[0].payload as MqttPublishMessage;
final payload = MqttPublishPayload.bytesToStringAsString(message.payload.message);
String payload = utf8.decode(MqttPublishPayload.bytesToStringAsString(message.payload.message).codeUnits);
var topic = message.variableHeader?.topicName;
Util.logInfo('message received');
@@ -238,6 +238,14 @@ class MqttCore {
MyApp.isarInstance.jobs.putSync(newJob);
});
if (newJob.state == 0) {
if (newJob.global) {
await Util.playMp3('aaa.mp3');
} else {
await Util.playMp3('job_received.mp3');
}
}
MessageService().publish<JobReceivedMessage>(Constants.messageTopicJobReceived, arguments: JobReceivedMessage(job: newJob));
}
}
@@ -259,15 +267,7 @@ class MqttCore {
void _syncRequestReceived(payloadData) async {
Util.logInfo('_syncRequestReceived');
/*for (var foundJobData in payloadData) {
Job newJob = Job.fromJson(foundJobData);
await MyApp.isarInstance.writeTxn(() async {
await MyApp.isarInstance.jobs.put(newJob);
});
BroadcastReceiver().publish<JobReceivedMessage>(Constants.messageTopicJobReceived, arguments: JobReceivedMessage(job: newJob));
}*/
_sendSyncMessage();
}
void _messageMessageReceived(Map<String, dynamic> payloadData) async {
@@ -277,6 +277,8 @@ class MqttCore {
await MyApp.isarInstance.messages.put(newMessage);
});
await Util.playMp3('asbeep.mp3');
MessageService().publish<MessageReceivedMessage>(Constants.messageTopicMessageReceived, arguments: MessageReceivedMessage(message: newMessage));
}
@@ -400,7 +402,7 @@ class MqttCore {
}
void _cancelTrackTimer() {
if (_trackTimer != null) {
if (_trackTimer != null && _trackTimer!.isActive) {
_trackTimer!.cancel();
}
}
+7 -37
View File
@@ -1,5 +1,6 @@
import 'dart:io';
import 'package:audioplayers/audioplayers.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -181,45 +182,14 @@ class Util {
throw Exception('Could not launch $websiteUrl');
}
}
static Future<void> playMp3(String name) async {
final player = AudioPlayer();
await player.play(AssetSource('sounds/$name'), volume: 1);
}
}
Widget getDefaultButton(String text, Function() onPressed, {Image? image, double? buttonHeight}) {
/*return SizedBox(
height: buttonHeight ?? 60,
child: Stack(
fit: StackFit.expand,
children: [
Row(
children: [
Padding(
padding: const EdgeInsets.all(0),
child: Expanded(
child: SizedBox(
height: 60,
child: ElevatedButton(
style: ButtonStyle(
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
side: const BorderSide(color: Colors.grey),
),
),
backgroundColor: MaterialStateProperty.all<Color>(const Color.fromARGB(255, 220, 220, 220)),
foregroundColor: MaterialStateProperty.all<Color>(Colors.black),
),
onPressed: () {
onPressed();
},
child: Text(text)),
),
),
),
],
),
Positioned(left: 20, top: 15, child: Center(child: image))
],
),
);*/
return SizedBox(
height: buttonHeight ?? 50,
child: MaterialButton(
@@ -244,7 +214,7 @@ Widget getDefaultButton(String text, Function() onPressed, {Image? image, double
Expanded(
child: Text(
text,
style: const TextStyle(color: Colors.black, fontSize: 18.0),
style: const TextStyle(color: Colors.black, fontSize: 14.0),
textAlign: TextAlign.center,
),
),
+64
View File
@@ -57,6 +57,62 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.11.0"
audioplayers:
dependency: "direct main"
description:
name: audioplayers
sha256: c05c6147124cd63e725e861335a8b4d57300b80e6e92cea7c145c739223bbaef
url: "https://pub.dev"
source: hosted
version: "5.2.1"
audioplayers_android:
dependency: transitive
description:
name: audioplayers_android
sha256: b00e1a0e11365d88576320ec2d8c192bc21f1afb6c0e5995d1c57ae63156acb5
url: "https://pub.dev"
source: hosted
version: "4.0.3"
audioplayers_darwin:
dependency: transitive
description:
name: audioplayers_darwin
sha256: "3034e99a6df8d101da0f5082dcca0a2a99db62ab1d4ddb3277bed3f6f81afe08"
url: "https://pub.dev"
source: hosted
version: "5.0.2"
audioplayers_linux:
dependency: transitive
description:
name: audioplayers_linux
sha256: "60787e73fefc4d2e0b9c02c69885402177e818e4e27ef087074cf27c02246c9e"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
audioplayers_platform_interface:
dependency: transitive
description:
name: audioplayers_platform_interface
sha256: "365c547f1bb9e77d94dd1687903a668d8f7ac3409e48e6e6a3668a1ac2982adb"
url: "https://pub.dev"
source: hosted
version: "6.1.0"
audioplayers_web:
dependency: transitive
description:
name: audioplayers_web
sha256: "22cd0173e54d92bd9b2c80b1204eb1eb159ece87475ab58c9788a70ec43c2a62"
url: "https://pub.dev"
source: hosted
version: "4.1.0"
audioplayers_windows:
dependency: transitive
description:
name: audioplayers_windows
sha256: "9536812c9103563644ada2ef45ae523806b0745f7a78e89d1b5fb1951de90e1a"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
badges:
dependency: "direct main"
description:
@@ -1197,6 +1253,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.0"
synchronized:
dependency: transitive
description:
name: synchronized
sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558"
url: "https://pub.dev"
source: hosted
version: "3.1.0+1"
term_glyph:
dependency: transitive
description:
+2
View File
@@ -67,6 +67,7 @@ dependencies:
geolocator: ^10.1.0
expandable: ^5.0.1
url_launcher: ^6.2.4
audioplayers: ^5.2.1
dev_dependencies:
flutter_test:
@@ -96,6 +97,7 @@ flutter:
assets:
- assets/
- assets/sounds/
# To add assets to your application, add an assets section, like this:
# assets: