Erweiterungen
This commit is contained in:
1 parent
286c6537b9
commit
4526dd174f
9 files changed
+160
-93
No files matched your search
@@ -59,7 +59,22 @@ class _ApproachAreaPageState extends State<ApproachAreaPage> {
|
||||
return Util.getWaitWidget(context);
|
||||
}
|
||||
|
||||
return const Text("Hello World!");
|
||||
return SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
children: [
|
||||
Container(width: 80, child: Text('Row 1')),
|
||||
Container(width: 80, child: Text('Row 2')),
|
||||
Container(width: 80, child: Text('Row 3')),
|
||||
Container(width: 80, child: Text('Row 4')),
|
||||
Container(width: 80, child: Text('Row 5')),
|
||||
Container(width: 80, child: Text('Row 6')),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _clicked(Job job) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'package:stadtbote/main.dart';
|
||||
import 'package:stadtbote/model/message.dart' as sbmessage;
|
||||
import 'package:stadtbote/model/status.dart';
|
||||
import 'package:stadtbote/popups/infos_popup.dart';
|
||||
import 'package:stadtbote/tools/mqtt_core.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
import '../tools/util.dart';
|
||||
@@ -94,12 +95,14 @@ class _MessagesPageState extends State<MessagesPage> {
|
||||
message.from = _sid;
|
||||
message.subj = '';
|
||||
message.time = DateFormat("yyyy.mm.dd HH:mm").format(DateTime.now());
|
||||
message.id = 0;
|
||||
message.id = await sbmessage.Message.getNextId();
|
||||
|
||||
MyApp.isarInstance.writeTxnSync(() {
|
||||
MyApp.isarInstance.messages.putSync(message);
|
||||
});
|
||||
|
||||
MqttCore.instance.publishPayloadMessage('mssg', message.toJson());
|
||||
|
||||
_messages.insert(0, types.TextMessage(
|
||||
author: _user,
|
||||
createdAt: DateTime.now().millisecondsSinceEpoch,
|
||||
@@ -120,7 +123,7 @@ class _MessagesPageState extends State<MessagesPage> {
|
||||
text += '$textLine\n';
|
||||
}
|
||||
|
||||
_messages.add(types.TextMessage(
|
||||
_messages.insert(0, types.TextMessage(
|
||||
author: message.from == _sid ? _user : _central,
|
||||
createdAt: DateTime.now().millisecondsSinceEpoch,
|
||||
id: const Uuid().v4().toString(),
|
||||
|
||||
@@ -148,7 +148,7 @@ class _TaskListPageState extends State<TaskListPage> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
utf8.decode(taskInfo.task.topic.codeUnits),
|
||||
taskInfo.task.topic,
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
color: textColor,
|
||||
@@ -332,7 +332,7 @@ class _TaskListPageState extends State<TaskListPage> {
|
||||
|
||||
void _processPickupDeliveryStatusTask(TaskInfo taskInfo) {
|
||||
Future.delayed(const Duration(seconds: 1), () async {
|
||||
_popup = showPickupDeliveryStatusPopup(context, taskInfo, () => {
|
||||
_popup = showPickupDeliveryStatusPopup(context, taskInfo, (tourEntry) => {
|
||||
_popup.dismiss(context),
|
||||
|
||||
taskInfo.completed = true,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:stadtbote/tools/util.dart';
|
||||
|
||||
part 'message.g.dart';
|
||||
|
||||
@@ -21,4 +22,14 @@ class Message {
|
||||
factory Message.fromJson(Map<String, dynamic> json) => _$MessageFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$MessageToJson(this);
|
||||
|
||||
static Future<int> getNextId() async {
|
||||
int currentExport500Id = await Util.preferencesGetInt('next_message_id', 0) as int;
|
||||
|
||||
currentExport500Id += 1;
|
||||
|
||||
Util.preferencesSaveInt("next_message_id", currentExport500Id);
|
||||
|
||||
return currentExport500Id;
|
||||
}
|
||||
}
|
||||
@@ -1,72 +1,71 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:kumi_popup_window/kumi_popup_window.dart';
|
||||
import 'package:stadtbote/model/task_info.dart';
|
||||
import 'package:stadtbote/model/tour_task.dart';
|
||||
import 'package:stadtbote/tools/util.dart';
|
||||
|
||||
KumiPopupWindow showPickupDeliveryStatusPopup(BuildContext context, TaskInfo taskInfo, Function() onFinished) {
|
||||
return showPopupWindow(
|
||||
context,
|
||||
//childSize:Size(240, MediaQuery.of(context).size.width * 0.8),
|
||||
gravity: KumiPopupGravity.center,
|
||||
//curve: Curves.elasticOut,
|
||||
bgColor: Colors.grey.withOpacity(0.5),
|
||||
clickOutDismiss: false,
|
||||
clickBackDismiss: true,
|
||||
customAnimation: false,
|
||||
customPop: false,
|
||||
customPage: false,
|
||||
// targetRenderBox: (btnKey.currentContext.findRenderObject() as RenderBox),
|
||||
//needSafeDisplay: true,
|
||||
underStatusBar: false,
|
||||
underAppBar: false,
|
||||
//offsetX: -180,
|
||||
//offsetY: 50,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
onShowStart: (pop) {},
|
||||
onShowFinish: (pop) {},
|
||||
onDismissStart: (pop) {},
|
||||
onDismissFinish: (pop) {},
|
||||
onClickOut: (pop) {},
|
||||
onClickBack: (pop) {},
|
||||
childFun: (pop) {
|
||||
return SizedBox(
|
||||
key: GlobalKey(),
|
||||
height: MediaQuery.of(context).size.height * 0.2,
|
||||
width: MediaQuery.of(context).size.width * 0.8,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(taskInfo.task.topic),
|
||||
const SizedBox(height: 20),
|
||||
/*DropdownMenu<String>(
|
||||
onSelected: (String? value) {
|
||||
},
|
||||
/*dropdownMenuEntries: list.map<DropdownMenuEntry<String>>((String value) {
|
||||
return DropdownMenuEntry<String>(value: value, label: value);
|
||||
}).toList(),*/
|
||||
),*/
|
||||
getDefaultButton('Übernehmen', buttonHeight: 50, () => {
|
||||
onFinished()
|
||||
})
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
},
|
||||
);
|
||||
showPickupDeliveryStatusPopup(BuildContext context, TaskInfo taskInfo, Function(TourEntry?) onFinished) async {
|
||||
List<DropdownMenuEntry<TourEntry>> entries = [];
|
||||
for (var entry in taskInfo.task.entries!) {
|
||||
var dropdownMenuEntry = DropdownMenuEntry<TourEntry>(value: entry, label: entry.text);
|
||||
entries.add(dropdownMenuEntry);
|
||||
}
|
||||
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
TourEntry? selectedTourEntry;
|
||||
|
||||
TextEditingController controller = TextEditingController();
|
||||
|
||||
return AlertDialog(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
shadowColor: Colors.transparent,
|
||||
backgroundColor: Colors.white,
|
||||
content: StatefulBuilder(
|
||||
builder: (BuildContext context, StateSetter setState) {
|
||||
return SizedBox(
|
||||
key: GlobalKey(),
|
||||
height: 280,
|
||||
width: MediaQuery.of(context).size.width * 0.8,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(taskInfo.task.topic),
|
||||
const SizedBox(height: 20),
|
||||
DropdownMenu<TourEntry>(
|
||||
expandedInsets: const EdgeInsets.all(0),
|
||||
controller: controller,
|
||||
hintText: 'Status',
|
||||
onSelected: (TourEntry? value) {
|
||||
selectedTourEntry = value;
|
||||
|
||||
controller.text = value!.text;
|
||||
setState(() {});
|
||||
},
|
||||
dropdownMenuEntries: entries,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Visibility(visible: selectedTourEntry != null ? selectedTourEntry!.queryRemark : false, child: Util.getDefaultTextField("Bemerkung")),
|
||||
const SizedBox(height: 20),
|
||||
getDefaultButton('Übernehmen', buttonHeight: 50, () => {
|
||||
onFinished(selectedTourEntry)
|
||||
})
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
},
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,31 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'chat_message.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class ChatMessage {
|
||||
late MessageContent mssg;
|
||||
|
||||
ChatMessage();
|
||||
|
||||
factory ChatMessage.fromJson(Map<String, dynamic> json) => _$ChatMessageFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$ChatMessageToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
class MessageContent
|
||||
{
|
||||
late String text;
|
||||
|
||||
late String subj;
|
||||
|
||||
late String time;
|
||||
|
||||
MessageContent();
|
||||
|
||||
factory MessageContent.fromJson(Map<String, dynamic> json) => _$MessageContentFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$MessageContentToJson(this);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'chat_message.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
ChatMessage _$ChatMessageFromJson(Map<String, dynamic> json) => ChatMessage()
|
||||
..mssg = MessageContent.fromJson(json['mssg'] as Map<String, dynamic>);
|
||||
|
||||
Map<String, dynamic> _$ChatMessageToJson(ChatMessage instance) =>
|
||||
<String, dynamic>{
|
||||
'mssg': instance.mssg,
|
||||
};
|
||||
|
||||
MessageContent _$MessageContentFromJson(Map<String, dynamic> json) =>
|
||||
MessageContent()
|
||||
..text = json['text'] as String
|
||||
..subj = json['subj'] as String
|
||||
..time = json['time'] as String;
|
||||
|
||||
Map<String, dynamic> _$MessageContentToJson(MessageContent instance) =>
|
||||
<String, dynamic>{
|
||||
'text': instance.text,
|
||||
'subj': instance.subj,
|
||||
'time': instance.time,
|
||||
};
|
||||
@@ -3,22 +3,6 @@ import 'package:stadtbote/protocoll_messages/fin_task_message.dart';
|
||||
|
||||
part 'track_message.g.dart';
|
||||
|
||||
/*
|
||||
var payloadObject = new JObject();
|
||||
|
||||
var posObject = new JObject();
|
||||
payloadObject.Add(new JProperty("pos", posObject));
|
||||
posObject.Add(new JProperty("time", DateTime.Now.ToString("o")));
|
||||
posObject.Add(new JProperty("lat", location.Latitude));
|
||||
posObject.Add(new JProperty("long", location.Longitude));
|
||||
if (location.Accuracy != null)
|
||||
{
|
||||
posObject.Add(new JProperty("acc", (int)location.Accuracy));
|
||||
}
|
||||
|
||||
SendJsonMessageAsync("track", payloadObject);
|
||||
*/
|
||||
|
||||
@JsonSerializable()
|
||||
class TrackMessage {
|
||||
late FinTaskPos pos;
|
||||
|
||||
+2
-6
@@ -73,15 +73,11 @@ class Util {
|
||||
}
|
||||
|
||||
static logInfo(String message) {
|
||||
if (kDebugMode) {
|
||||
print(message);
|
||||
}
|
||||
debugPrint(message);
|
||||
}
|
||||
|
||||
static logException(String message) {
|
||||
if (kDebugMode) {
|
||||
print('Exception: $message');
|
||||
}
|
||||
debugPrint('Exception: $message');
|
||||
}
|
||||
|
||||
static int fastHash(String string) {
|
||||
|
||||
Reference in new issue
Block a user