Erweiterungen
This commit is contained in:
1 parent
52415e0759
commit
265d75a99b
10 files changed
+481
-406
No files matched your search
+130
-105
@@ -91,22 +91,21 @@ class _MainPageState extends State<MainPage> with ConsumerMixin, ProducerMixin {
|
||||
badgeColor: Colors.red,
|
||||
padding: const EdgeInsets.all(10),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
borderSide: const BorderSide(color: Colors.white, width: 0),
|
||||
borderSide:
|
||||
const BorderSide(color: Colors.white, width: 0),
|
||||
elevation: 0,
|
||||
),
|
||||
child: getDefaultButton(
|
||||
'Zugewiesene Aufträge',
|
||||
image: Image.asset('assets/zugewiesene_auftraege.png', width: 30, height: 30),
|
||||
image: Image.asset('assets/zugewiesene_auftraege.png',
|
||||
width: 30, height: 30),
|
||||
() async => {
|
||||
// TODO MESSAGING
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicPushContentView,
|
||||
payload: const AssignedJobsPage(),
|
||||
)
|
||||
|
||||
//await MessageService().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const AssignedJobsPage())
|
||||
}
|
||||
),
|
||||
sendMessage(
|
||||
routingKey:
|
||||
Constants.messageTopicPushContentView,
|
||||
payload: const AssignedJobsPage(),
|
||||
)
|
||||
}),
|
||||
);
|
||||
},
|
||||
),
|
||||
@@ -119,7 +118,8 @@ class _MainPageState extends State<MainPage> with ConsumerMixin, ProducerMixin {
|
||||
builder: (context, value, child) {
|
||||
return badges.Badge(
|
||||
showBadge: value > 0,
|
||||
position: badges.BadgePosition.topEnd(top: -12, end: -5),
|
||||
position:
|
||||
badges.BadgePosition.topEnd(top: -12, end: -5),
|
||||
badgeContent: Text(
|
||||
value.toString(),
|
||||
style: const TextStyle(
|
||||
@@ -131,23 +131,23 @@ class _MainPageState extends State<MainPage> with ConsumerMixin, ProducerMixin {
|
||||
badgeColor: Colors.red,
|
||||
padding: const EdgeInsets.all(10),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
borderSide: const BorderSide(color: Colors.white, width: 0),
|
||||
borderSide:
|
||||
const BorderSide(color: Colors.white, width: 0),
|
||||
elevation: 0,
|
||||
),
|
||||
child: getDefaultButton(
|
||||
'Angenommene Aufträge',
|
||||
image: Image.asset('assets/angenommene_auftraege.png', width: 30, height: 30),
|
||||
image: Image.asset(
|
||||
'assets/angenommene_auftraege.png',
|
||||
width: 30,
|
||||
height: 30),
|
||||
() async => {
|
||||
// TODO MESSAGING
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicPushContentView,
|
||||
payload: const AcceptedJobsPage(),
|
||||
)
|
||||
|
||||
//await MessageService().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const AcceptedJobsPage())
|
||||
}
|
||||
)
|
||||
);
|
||||
sendMessage(
|
||||
routingKey:
|
||||
Constants.messageTopicPushContentView,
|
||||
payload: const AcceptedJobsPage(),
|
||||
)
|
||||
}));
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -156,17 +156,14 @@ class _MainPageState extends State<MainPage> with ConsumerMixin, ProducerMixin {
|
||||
visible: !_loggedOut,
|
||||
child: getDefaultButton(
|
||||
'Erledigte Aufträge',
|
||||
image: Image.asset('assets/erledigte_auftraege.png', width: 30, height: 30),
|
||||
image: Image.asset('assets/erledigte_auftraege.png',
|
||||
width: 30, height: 30),
|
||||
() async => {
|
||||
// TODO MESSAGING
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicPushContentView,
|
||||
payload: const FinishedJobsPage(),
|
||||
)
|
||||
|
||||
//await MessageService().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const FinishedJobsPage())
|
||||
}
|
||||
),
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicPushContentView,
|
||||
payload: const FinishedJobsPage(),
|
||||
)
|
||||
}),
|
||||
),
|
||||
SizedBox(height: _loggedOut == true ? 0 : 20),
|
||||
Visibility(
|
||||
@@ -176,7 +173,8 @@ class _MainPageState extends State<MainPage> with ConsumerMixin, ProducerMixin {
|
||||
builder: (context, value, child) {
|
||||
return badges.Badge(
|
||||
showBadge: value > 0,
|
||||
position: badges.BadgePosition.topEnd(top: -12, end: -5),
|
||||
position:
|
||||
badges.BadgePosition.topEnd(top: -12, end: -5),
|
||||
badgeContent: Text(
|
||||
value.toString(),
|
||||
style: const TextStyle(
|
||||
@@ -188,23 +186,21 @@ class _MainPageState extends State<MainPage> with ConsumerMixin, ProducerMixin {
|
||||
badgeColor: Colors.red,
|
||||
padding: const EdgeInsets.all(10),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
borderSide: const BorderSide(color: Colors.white, width: 0),
|
||||
borderSide:
|
||||
const BorderSide(color: Colors.white, width: 0),
|
||||
elevation: 0,
|
||||
),
|
||||
child: getDefaultButton(
|
||||
'Nachrichten',
|
||||
image: Image.asset('assets/nachrichten.png', width: 30, height: 30),
|
||||
image: Image.asset('assets/nachrichten.png',
|
||||
width: 30, height: 30),
|
||||
() async => {
|
||||
// TODO MESSAGING
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicPushContentView,
|
||||
payload: const MessagesPage(),
|
||||
)
|
||||
|
||||
//await MessageService().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const MessagesPage())
|
||||
}
|
||||
)
|
||||
);
|
||||
sendMessage(
|
||||
routingKey:
|
||||
Constants.messageTopicPushContentView,
|
||||
payload: const MessagesPage(),
|
||||
)
|
||||
}));
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -213,30 +209,37 @@ class _MainPageState extends State<MainPage> with ConsumerMixin, ProducerMixin {
|
||||
visible: !_loggedOut,
|
||||
child: getDefaultButton(
|
||||
'Anfahrtsbereich',
|
||||
image: Image.asset('assets/anfahrtsbereich.png', width: 30, height: 30),
|
||||
() async => {
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicPushContentView,
|
||||
payload: const ApproachAreaPage(),
|
||||
)
|
||||
}),
|
||||
image: Image.asset('assets/anfahrtsbereich.png',
|
||||
width: 30, height: 30),
|
||||
() async => {
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicPushContentView,
|
||||
payload: const ApproachAreaPage(),
|
||||
)
|
||||
}),
|
||||
),
|
||||
SizedBox(height: _loggedOut == true ? 0 : 20),
|
||||
Visibility(
|
||||
visible: !_loggedOut && _showBWVButton,
|
||||
child: getDefaultButton(
|
||||
'Wunschziel für heute',
|
||||
image: Image.asset('assets/wunsch_plz.png', width: 30, height: 30),
|
||||
() async => {
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicPushContentView,
|
||||
payload: const SetDesiredZipPage(),
|
||||
)
|
||||
}),
|
||||
image: Image.asset('assets/wunsch_plz.png',
|
||||
width: 30, height: 30),
|
||||
() async => {
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicPushContentView,
|
||||
payload: const SetDesiredZipPage(),
|
||||
)
|
||||
}),
|
||||
),
|
||||
SizedBox(height: _loggedOut == true ? 0 : 20),
|
||||
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 {
|
||||
_logout(context);
|
||||
}),
|
||||
Expanded(
|
||||
@@ -299,19 +302,24 @@ class _MainPageState extends State<MainPage> with ConsumerMixin, ProducerMixin {
|
||||
);
|
||||
|
||||
subscribe(
|
||||
queueId: Constants.messageTopicBWVEnabled,
|
||||
callback: (message) {
|
||||
setState(() {
|
||||
_showBWVButton = Util.preferencesGetBool(Constants.prefsBWVEnabled, false);
|
||||
queueId: Constants.messageTopicBWVEnabled,
|
||||
callback: (message) {
|
||||
setState(() {
|
||||
_showBWVButton =
|
||||
Util.preferencesGetBool(Constants.prefsBWVEnabled, false);
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void _refreshBadges() async {
|
||||
_assignedJobsValueNotifier.value = await MyApp.isarInstance.jobs.filter().stateEqualTo(0).count();
|
||||
_acceptedJobsValueNotifier.value = await MyApp.isarInstance.jobs.filter().stateEqualTo(1).count();
|
||||
_messagesValueNotifier.value = await MyApp.isarInstance.chatMessages.filter().readEqualTo(false).count();
|
||||
_assignedJobsValueNotifier.value =
|
||||
await MyApp.isarInstance.jobs.filter().stateEqualTo(0).count();
|
||||
_acceptedJobsValueNotifier.value =
|
||||
await MyApp.isarInstance.jobs.filter().stateEqualTo(1).count();
|
||||
_messagesValueNotifier.value = await MyApp.isarInstance.chatMessages
|
||||
.filter()
|
||||
.readEqualTo(false)
|
||||
.count();
|
||||
}
|
||||
|
||||
void _jobReceived(Job job) {
|
||||
@@ -329,7 +337,7 @@ class _MainPageState extends State<MainPage> with ConsumerMixin, ProducerMixin {
|
||||
|
||||
_loggedOut = false;
|
||||
|
||||
setState(() { });
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,7 +347,8 @@ class _MainPageState extends State<MainPage> with ConsumerMixin, ProducerMixin {
|
||||
onPressed: () async {
|
||||
Navigator.of(context).pop();
|
||||
|
||||
showMessageDialog(context, "Information", "Sie werden abgemeldet.\nBitte warten...");
|
||||
showMessageDialog(
|
||||
context, "Information", "Sie werden abgemeldet.\nBitte warten...");
|
||||
|
||||
_sendLogoutMessage();
|
||||
|
||||
@@ -352,14 +361,11 @@ class _MainPageState extends State<MainPage> with ConsumerMixin, ProducerMixin {
|
||||
);
|
||||
|
||||
Future.delayed(const Duration(seconds: 3), () async {
|
||||
// TODO MESSAGING
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicDisconnectClient,
|
||||
payload: DisconnectClientMessage(),
|
||||
);
|
||||
|
||||
//await MessageService().publish<DisconnectClientMessage>(Constants.messageTopicDisconnectClient, arguments: DisconnectClientMessage());
|
||||
|
||||
Navigator.of(MyApp.appNavigatorKey.currentContext!).pop();
|
||||
|
||||
setState(() {});
|
||||
@@ -406,13 +412,13 @@ class _MainPageState extends State<MainPage> with ConsumerMixin, ProducerMixin {
|
||||
logoutMessage.pos!.acc = position.accuracy.toInt();
|
||||
}
|
||||
|
||||
// TODO MESSAGING
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicPublishPayload,
|
||||
payload: PublishPayloadMessage(topic: "logout", message: logoutMessage.toJson(), acknowledgeRequired: false),
|
||||
payload: PublishPayloadMessage(
|
||||
topic: "logout",
|
||||
message: logoutMessage.toJson(),
|
||||
acknowledgeRequired: false),
|
||||
);
|
||||
|
||||
//await MessageService().publish<PublishPayloadMessage>(Constants.messageTopicPublishPayload, arguments: PublishPayloadMessage(topic: "logout", message: logoutMessage.toJson(), qos: MqttQos.exactlyOnce));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -458,12 +464,14 @@ class _HeaderWidgetState extends State<_HeaderWidget> with ConsumerMixin {
|
||||
),
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
},
|
||||
onTap: () async {},
|
||||
child: const CircleAvatar(
|
||||
radius: 10,
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
child: Padding(padding: EdgeInsets.all(1.0), child: Icon(Icons.info_outline, size: 20.0, color: Colors.white)),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(1.0),
|
||||
child: Icon(Icons.info_outline,
|
||||
size: 20.0, color: Colors.white)),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -481,18 +489,24 @@ class _HeaderWidgetState extends State<_HeaderWidget> with ConsumerMixin {
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
var sessionStatus = await MyApp.isarInstance.sessionStatus.where().findFirst();
|
||||
var sessionStatus = await MyApp
|
||||
.isarInstance.sessionStatus
|
||||
.where()
|
||||
.findFirst();
|
||||
|
||||
showInfosPopup(sessionStatus);
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
radius: 10,
|
||||
child: Padding(padding: EdgeInsets.all(1.0), child: Icon(Icons.info_outline, size: 20.0, color: Colors.white))),
|
||||
),
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
radius: 10,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(1.0),
|
||||
child: Icon(Icons.info_outline,
|
||||
size: 20.0, color: Colors.white))),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
@@ -501,7 +515,8 @@ class _HeaderWidgetState extends State<_HeaderWidget> with ConsumerMixin {
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, // Verteilt die Texte gleichmäßig in der Zeile
|
||||
mainAxisAlignment: MainAxisAlignment
|
||||
.spaceBetween, // Verteilt die Texte gleichmäßig in der Zeile
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: cellWidth,
|
||||
@@ -522,21 +537,24 @@ class _HeaderWidgetState extends State<_HeaderWidget> with ConsumerMixin {
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, // Verteilt die Texte gleichmäßig in der Zeile
|
||||
mainAxisAlignment: MainAxisAlignment
|
||||
.spaceBetween, // Verteilt die Texte gleichmäßig in der Zeile
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: cellWidth,
|
||||
child: ValueListenableBuilder<String>(
|
||||
valueListenable: _zipValueNotifier,
|
||||
builder: (context, value, child) {
|
||||
return Text(
|
||||
textAlign: TextAlign.center,
|
||||
value,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: Colors.white),
|
||||
);
|
||||
},
|
||||
)
|
||||
),
|
||||
width: cellWidth,
|
||||
child: ValueListenableBuilder<String>(
|
||||
valueListenable: _zipValueNotifier,
|
||||
builder: (context, value, child) {
|
||||
return Text(
|
||||
textAlign: TextAlign.center,
|
||||
value,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18,
|
||||
color: Colors.white),
|
||||
);
|
||||
},
|
||||
)),
|
||||
SizedBox(
|
||||
width: cellWidth,
|
||||
child: ValueListenableBuilder<String>(
|
||||
@@ -545,7 +563,10 @@ class _HeaderWidgetState extends State<_HeaderWidget> with ConsumerMixin {
|
||||
return Text(
|
||||
textAlign: TextAlign.center,
|
||||
value,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: Colors.white),
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18,
|
||||
color: Colors.white),
|
||||
);
|
||||
},
|
||||
),
|
||||
@@ -565,7 +586,10 @@ class _HeaderWidgetState extends State<_HeaderWidget> with ConsumerMixin {
|
||||
return Text(
|
||||
textAlign: TextAlign.center,
|
||||
value,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: Colors.white),
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18,
|
||||
color: Colors.white),
|
||||
);
|
||||
},
|
||||
),
|
||||
@@ -597,7 +621,8 @@ class _HeaderWidgetState extends State<_HeaderWidget> with ConsumerMixin {
|
||||
|
||||
_updateHeader() async {
|
||||
var status = await MyApp.isarInstance.locationStatus.where().findFirst();
|
||||
var sessionStatus = await MyApp.isarInstance.sessionStatus.where().findFirst();
|
||||
var sessionStatus =
|
||||
await MyApp.isarInstance.sessionStatus.where().findFirst();
|
||||
|
||||
if (status != null) {
|
||||
_zipValueNotifier.value = status.zip;
|
||||
|
||||
Reference in new issue
Block a user