Erweiterungen
This commit is contained in:
1 parent
e0b30366e5
commit
efb55331d2
2 files changed
+36
-12
No files matched your search
@@ -14,6 +14,7 @@ import 'package:stadtbote/model/status.dart';
|
||||
import 'package:stadtbote/popups/accept_jobs_popup.dart';
|
||||
import 'package:stadtbote/popups/infos_popup.dart';
|
||||
import 'package:stadtbote/tools/message_service.dart';
|
||||
import 'package:stadtbote/tools/messages/job_deleted_message.dart';
|
||||
import 'package:stadtbote/tools/messages/job_received_message.dart';
|
||||
import 'package:stadtbote/tools/messages/message_message.dart';
|
||||
import 'package:stadtbote/tools/messages/session_info_update.dart';
|
||||
@@ -250,6 +251,10 @@ class _MainPageState extends State<MainPage> {
|
||||
MessageService().subscribe<MessageReceivedMessage>(Constants.messageTopicMessageReceived, this, (MessageReceivedMessage mesage) {
|
||||
_refreshBadges();
|
||||
});
|
||||
|
||||
MessageService().subscribe<JobDeletedMessage>(Constants.messageTopicJobDeleted, this, (JobDeletedMessage job) {
|
||||
_refreshBadges();
|
||||
});
|
||||
}
|
||||
|
||||
void _exitMessages() {
|
||||
|
||||
@@ -37,6 +37,12 @@ Future<void> showAcceptJobsPopup(BuildContext context, List<Job> jobs) async {
|
||||
itemBuilder: (_, i) {
|
||||
var job = jobsSet.toList()[i];
|
||||
|
||||
String remarkString = '';
|
||||
for (var remark in job.rem) {
|
||||
remarkString += '$remark\n';
|
||||
}
|
||||
remarkString = remarkString.trim();
|
||||
|
||||
return ExpandableNotifier(
|
||||
child: ListTile(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 8, vertical: 8),
|
||||
@@ -50,7 +56,7 @@ Future<void> showAcceptJobsPopup(BuildContext context, List<Job> jobs) async {
|
||||
),
|
||||
child: badges.Badge(
|
||||
position: badges.BadgePosition.topEnd(top: -13, end: -5),
|
||||
showBadge: true,
|
||||
showBadge: false,
|
||||
badgeContent: const Text(
|
||||
'Neu',
|
||||
style: TextStyle(
|
||||
@@ -69,13 +75,25 @@ Future<void> showAcceptJobsPopup(BuildContext context, List<Job> jobs) async {
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(DateFormat('dd.MM.yyyy HH:mm').format(DateTime.parse(job.ordertime)).toString(),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: Text(DateFormat('dd.MM.yyyy HH:mm').format(DateTime.parse(job.ordertime)).toString(),
|
||||
textAlign: TextAlign.left),
|
||||
Text('Auftragsnummer: ${job.id}'),
|
||||
Text(job.tours[0].comp),
|
||||
Text(job.tours[0].street),
|
||||
Text(job.tours[0].city),
|
||||
const SizedBox(height: 20),
|
||||
),
|
||||
SizedBox(width: double.infinity, child: Text('Auftragsnummer: ${job.id}', textAlign: TextAlign.left)),
|
||||
SizedBox(width: double.infinity, child: Text(job.tours[0].comp, textAlign: TextAlign.left)),
|
||||
SizedBox(width: double.infinity, child: Text(job.tours[0].street, textAlign: TextAlign.left)),
|
||||
SizedBox(width: double.infinity, child: Text(job.tours[0].city, textAlign: TextAlign.left)),
|
||||
Row(
|
||||
children: [
|
||||
Image.asset("assets/${mapVehicleTypeToImageName(job.vhtId)}", width: 60, height: 60),
|
||||
const SizedBox(width: 10),
|
||||
Text(
|
||||
mapVehicleTypeToText(job.vhtId)
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
ScrollOnExpand(
|
||||
scrollOnExpand: true,
|
||||
scrollOnCollapse: false,
|
||||
@@ -92,7 +110,7 @@ Future<void> showAcceptJobsPopup(BuildContext context, List<Job> jobs) async {
|
||||
)),
|
||||
collapsed: const SizedBox(),
|
||||
expanded: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: 200,
|
||||
@@ -104,7 +122,10 @@ Future<void> showAcceptJobsPopup(BuildContext context, List<Job> jobs) async {
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
child: const Text('asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd '),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(remarkString),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -153,7 +174,5 @@ _sendAnswer(Job job, int item) {
|
||||
MqttCore.instance.publishPayloadMessage("job", message.toJson());
|
||||
|
||||
job.state = 9;
|
||||
MyApp.isarInstance.writeTxnSync(() => {
|
||||
MyApp.isarInstance.jobs.putSync(job)
|
||||
});
|
||||
MyApp.isarInstance.writeTxnSync(() => {MyApp.isarInstance.jobs.putSync(job)});
|
||||
}
|
||||
Reference in new issue
Block a user