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 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) {
|
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/message.dart' as sbmessage;
|
||||||
import 'package:stadtbote/model/status.dart';
|
import 'package:stadtbote/model/status.dart';
|
||||||
import 'package:stadtbote/popups/infos_popup.dart';
|
import 'package:stadtbote/popups/infos_popup.dart';
|
||||||
|
import 'package:stadtbote/tools/mqtt_core.dart';
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
|
|
||||||
import '../tools/util.dart';
|
import '../tools/util.dart';
|
||||||
@@ -94,12 +95,14 @@ class _MessagesPageState extends State<MessagesPage> {
|
|||||||
message.from = _sid;
|
message.from = _sid;
|
||||||
message.subj = '';
|
message.subj = '';
|
||||||
message.time = DateFormat("yyyy.mm.dd HH:mm").format(DateTime.now());
|
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.writeTxnSync(() {
|
||||||
MyApp.isarInstance.messages.putSync(message);
|
MyApp.isarInstance.messages.putSync(message);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
MqttCore.instance.publishPayloadMessage('mssg', message.toJson());
|
||||||
|
|
||||||
_messages.insert(0, types.TextMessage(
|
_messages.insert(0, types.TextMessage(
|
||||||
author: _user,
|
author: _user,
|
||||||
createdAt: DateTime.now().millisecondsSinceEpoch,
|
createdAt: DateTime.now().millisecondsSinceEpoch,
|
||||||
@@ -120,7 +123,7 @@ class _MessagesPageState extends State<MessagesPage> {
|
|||||||
text += '$textLine\n';
|
text += '$textLine\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
_messages.add(types.TextMessage(
|
_messages.insert(0, types.TextMessage(
|
||||||
author: message.from == _sid ? _user : _central,
|
author: message.from == _sid ? _user : _central,
|
||||||
createdAt: DateTime.now().millisecondsSinceEpoch,
|
createdAt: DateTime.now().millisecondsSinceEpoch,
|
||||||
id: const Uuid().v4().toString(),
|
id: const Uuid().v4().toString(),
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ class _TaskListPageState extends State<TaskListPage> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
utf8.decode(taskInfo.task.topic.codeUnits),
|
taskInfo.task.topic,
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: textColor,
|
color: textColor,
|
||||||
@@ -332,7 +332,7 @@ class _TaskListPageState extends State<TaskListPage> {
|
|||||||
|
|
||||||
void _processPickupDeliveryStatusTask(TaskInfo taskInfo) {
|
void _processPickupDeliveryStatusTask(TaskInfo taskInfo) {
|
||||||
Future.delayed(const Duration(seconds: 1), () async {
|
Future.delayed(const Duration(seconds: 1), () async {
|
||||||
_popup = showPickupDeliveryStatusPopup(context, taskInfo, () => {
|
_popup = showPickupDeliveryStatusPopup(context, taskInfo, (tourEntry) => {
|
||||||
_popup.dismiss(context),
|
_popup.dismiss(context),
|
||||||
|
|
||||||
taskInfo.completed = true,
|
taskInfo.completed = true,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:isar/isar.dart';
|
import 'package:isar/isar.dart';
|
||||||
import 'package:json_annotation/json_annotation.dart';
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
|
import 'package:stadtbote/tools/util.dart';
|
||||||
|
|
||||||
part 'message.g.dart';
|
part 'message.g.dart';
|
||||||
|
|
||||||
@@ -21,4 +22,14 @@ class Message {
|
|||||||
factory Message.fromJson(Map<String, dynamic> json) => _$MessageFromJson(json);
|
factory Message.fromJson(Map<String, dynamic> json) => _$MessageFromJson(json);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => _$MessageToJson(this);
|
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:flutter/material.dart';
|
||||||
import 'package:kumi_popup_window/kumi_popup_window.dart';
|
import 'package:kumi_popup_window/kumi_popup_window.dart';
|
||||||
import 'package:stadtbote/model/task_info.dart';
|
import 'package:stadtbote/model/task_info.dart';
|
||||||
|
import 'package:stadtbote/model/tour_task.dart';
|
||||||
import 'package:stadtbote/tools/util.dart';
|
import 'package:stadtbote/tools/util.dart';
|
||||||
|
|
||||||
KumiPopupWindow showPickupDeliveryStatusPopup(BuildContext context, TaskInfo taskInfo, Function() onFinished) {
|
showPickupDeliveryStatusPopup(BuildContext context, TaskInfo taskInfo, Function(TourEntry?) onFinished) async {
|
||||||
return showPopupWindow(
|
List<DropdownMenuEntry<TourEntry>> entries = [];
|
||||||
context,
|
for (var entry in taskInfo.task.entries!) {
|
||||||
//childSize:Size(240, MediaQuery.of(context).size.width * 0.8),
|
var dropdownMenuEntry = DropdownMenuEntry<TourEntry>(value: entry, label: entry.text);
|
||||||
gravity: KumiPopupGravity.center,
|
entries.add(dropdownMenuEntry);
|
||||||
//curve: Curves.elasticOut,
|
}
|
||||||
bgColor: Colors.grey.withOpacity(0.5),
|
|
||||||
clickOutDismiss: false,
|
await showDialog<void>(
|
||||||
clickBackDismiss: true,
|
context: context,
|
||||||
customAnimation: false,
|
builder: (BuildContext context) {
|
||||||
customPop: false,
|
TourEntry? selectedTourEntry;
|
||||||
customPage: false,
|
|
||||||
// targetRenderBox: (btnKey.currentContext.findRenderObject() as RenderBox),
|
TextEditingController controller = TextEditingController();
|
||||||
//needSafeDisplay: true,
|
|
||||||
underStatusBar: false,
|
return AlertDialog(
|
||||||
underAppBar: false,
|
contentPadding: EdgeInsets.zero,
|
||||||
//offsetX: -180,
|
shadowColor: Colors.transparent,
|
||||||
//offsetY: 50,
|
backgroundColor: Colors.white,
|
||||||
duration: const Duration(milliseconds: 200),
|
content: StatefulBuilder(
|
||||||
onShowStart: (pop) {},
|
builder: (BuildContext context, StateSetter setState) {
|
||||||
onShowFinish: (pop) {},
|
return SizedBox(
|
||||||
onDismissStart: (pop) {},
|
key: GlobalKey(),
|
||||||
onDismissFinish: (pop) {},
|
height: 280,
|
||||||
onClickOut: (pop) {},
|
width: MediaQuery.of(context).size.width * 0.8,
|
||||||
onClickBack: (pop) {},
|
child: Container(
|
||||||
childFun: (pop) {
|
decoration: BoxDecoration(
|
||||||
return SizedBox(
|
borderRadius: BorderRadius.circular(10),
|
||||||
key: GlobalKey(),
|
color: Colors.white,
|
||||||
height: MediaQuery.of(context).size.height * 0.2,
|
border: Border.all(
|
||||||
width: MediaQuery.of(context).size.width * 0.8,
|
color: Colors.grey,
|
||||||
child: Container(
|
width: 0.5,
|
||||||
decoration: BoxDecoration(
|
),
|
||||||
borderRadius: BorderRadius.circular(10),
|
),
|
||||||
color: Colors.white,
|
child: Padding(
|
||||||
border: Border.all(
|
padding: const EdgeInsets.all(8.0),
|
||||||
color: Colors.grey,
|
child: Column(
|
||||||
width: 0.5,
|
children: [
|
||||||
),
|
Text(taskInfo.task.topic),
|
||||||
),
|
const SizedBox(height: 20),
|
||||||
child: Padding(
|
DropdownMenu<TourEntry>(
|
||||||
padding: const EdgeInsets.all(20.0),
|
expandedInsets: const EdgeInsets.all(0),
|
||||||
child: Column(
|
controller: controller,
|
||||||
children: [
|
hintText: 'Status',
|
||||||
Text(taskInfo.task.topic),
|
onSelected: (TourEntry? value) {
|
||||||
const SizedBox(height: 20),
|
selectedTourEntry = value;
|
||||||
/*DropdownMenu<String>(
|
|
||||||
onSelected: (String? value) {
|
controller.text = value!.text;
|
||||||
},
|
setState(() {});
|
||||||
/*dropdownMenuEntries: list.map<DropdownMenuEntry<String>>((String value) {
|
},
|
||||||
return DropdownMenuEntry<String>(value: value, label: value);
|
dropdownMenuEntries: entries,
|
||||||
}).toList(),*/
|
),
|
||||||
),*/
|
const SizedBox(height: 20),
|
||||||
getDefaultButton('Übernehmen', buttonHeight: 50, () => {
|
Visibility(visible: selectedTourEntry != null ? selectedTourEntry!.queryRemark : false, child: Util.getDefaultTextField("Bemerkung")),
|
||||||
onFinished()
|
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';
|
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()
|
@JsonSerializable()
|
||||||
class TrackMessage {
|
class TrackMessage {
|
||||||
late FinTaskPos pos;
|
late FinTaskPos pos;
|
||||||
|
|||||||
+2
-6
@@ -73,15 +73,11 @@ class Util {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static logInfo(String message) {
|
static logInfo(String message) {
|
||||||
if (kDebugMode) {
|
debugPrint(message);
|
||||||
print(message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static logException(String message) {
|
static logException(String message) {
|
||||||
if (kDebugMode) {
|
debugPrint('Exception: $message');
|
||||||
print('Exception: $message');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fastHash(String string) {
|
static int fastHash(String string) {
|
||||||
|
|||||||
Reference in new issue
Block a user