Erweiterungen
This commit is contained in:
1 parent
957b944b55
commit
2ca11f87a3
1 file changed
+15
-12
@@ -144,11 +144,11 @@ Future<List<Widget>> _createListEntries() async {
|
||||
const SizedBox(height: 20),
|
||||
Row(children: [
|
||||
Expanded(
|
||||
child: getDefaultButton(!job.global ? 'Ablehnen' : 'Ignorieren', () => { _sendAnswer(!job.global ? 2: 3)}),
|
||||
child: getDefaultButton(!job.global ? 'Ablehnen' : 'Ignorieren', () => { _sendAnswer(job, !job.global ? 2: 3)}),
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
Expanded(
|
||||
child: getDefaultButton('Annehmen', () => {_sendAnswer(1)}),
|
||||
child: getDefaultButton('Annehmen', () => {_sendAnswer(job, 1)}),
|
||||
)
|
||||
])
|
||||
],
|
||||
@@ -194,15 +194,18 @@ private void SendAnswer(int item)
|
||||
}
|
||||
*/
|
||||
|
||||
_sendAnswer(int item) {
|
||||
var answer = AcceptJobMessage();
|
||||
answer.reaction = Reaction();
|
||||
answer.reaction.item = item;
|
||||
answer.reaction.id = const Uuid().v4().toString();
|
||||
answer.reaction.track = Track();
|
||||
answer.reaction.track.time = DateTime.now().toUtc().toIso8601String();
|
||||
_sendAnswer(Job job, int item) {
|
||||
var message = AcceptJobMessage();
|
||||
message.reaction = Reaction();
|
||||
message.reaction.id = job.id.toString();
|
||||
message.reaction.ver = job.ver.toString();
|
||||
message.reaction.item = item;
|
||||
message.reaction.track = Track();
|
||||
message.reaction.track.time = DateTime.now().toUtc().toIso8601String();
|
||||
message.reaction.track.pos = Pos();
|
||||
message.reaction.track.pos.lat = 0;
|
||||
message.reaction.track.pos.long = 0;
|
||||
message.reaction.track.pos.acc = 1;
|
||||
|
||||
var json = answer.toJson();
|
||||
|
||||
MqttCore.instance.publishPayloadMessage("server", json);
|
||||
MqttCore.instance.publishPayloadMessage("server", message.toJson());
|
||||
}
|
||||
Reference in new issue
Block a user