Erweiterungen
This commit is contained in:
1 parent
e0d66ce3b1
commit
5c095fb969
10 files changed
+507
-415
No files matched your search
@@ -1,21 +1,19 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_broadcast_receiver/flutter_broadcast_receiver.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:stadtbote/content_views/accepted_jobs_page.dart';
|
||||
import 'package:stadtbote/content_views/assigned_jobs_page.dart';
|
||||
import 'package:stadtbote/content_views/finished_jobs_page.dart';
|
||||
import 'package:stadtbote/content_views/messages_page.dart';
|
||||
import 'package:stadtbote/content_views/utils/content_view_widget.dart';
|
||||
import 'package:stadtbote/content_views/utils/header_info.dart';
|
||||
import 'package:stadtbote/model/job.dart';
|
||||
import 'package:stadtbote/model/status.dart';
|
||||
import 'package:stadtbote/popups/infos_popup.dart';
|
||||
import 'package:stadtbote/tools/session_info_update.dart';
|
||||
import 'package:badges/badges.dart' as badges;
|
||||
|
||||
import '../main.dart';
|
||||
import '../model/job.dart';
|
||||
import '../tools/constants.dart';
|
||||
import '../tools/util.dart';
|
||||
|
||||
@@ -78,10 +76,16 @@ class MainPage extends ContentViewWidget {
|
||||
}
|
||||
|
||||
class _MainPageState extends State<MainPage> {
|
||||
final ValueNotifier<int> _assignedJobsValueNotifier = ValueNotifier<int>(0);
|
||||
final ValueNotifier<int> _acceptedJobsValueNotifier = ValueNotifier<int>(0);
|
||||
final ValueNotifier<int> _messagesValueNotifier = ValueNotifier<int>(0);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_initBadges();
|
||||
|
||||
_initMessages();
|
||||
}
|
||||
|
||||
@@ -96,25 +100,94 @@ class _MainPageState extends State<MainPage> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
getDefaultButton(
|
||||
'Zugewiesene Aufträge',
|
||||
image: Image.asset('assets/zugewiesene_auftraege.png', width: 30, height: 30),
|
||||
() => {BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const AssignedJobsPage())}),
|
||||
ValueListenableBuilder<int>(
|
||||
valueListenable: _assignedJobsValueNotifier,
|
||||
builder: (context, value, child) {
|
||||
return badges.Badge(
|
||||
showBadge: value > 0,
|
||||
position: badges.BadgePosition.topEnd(top: 0, end: -5),
|
||||
badgeContent: Text(
|
||||
value.toString(),
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 13.0,
|
||||
),
|
||||
),
|
||||
badgeStyle: badges.BadgeStyle(
|
||||
badgeColor: Colors.red,
|
||||
padding: const EdgeInsets.all(10),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
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),
|
||||
() => {BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const AssignedJobsPage())})
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
getDefaultButton(
|
||||
'Angenommene Aufträge',
|
||||
image: Image.asset('assets/angenommene_auftraege.png', width: 30, height: 30),
|
||||
() => {BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const AcceptedJobsPage())}),
|
||||
ValueListenableBuilder<int>(
|
||||
valueListenable: _acceptedJobsValueNotifier,
|
||||
builder: (context, value, child) {
|
||||
return badges.Badge(
|
||||
showBadge: value > 0,
|
||||
position: badges.BadgePosition.topEnd(top: 0, end: -5),
|
||||
badgeContent: Text(
|
||||
value.toString(),
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 13.0,
|
||||
),
|
||||
),
|
||||
badgeStyle: badges.BadgeStyle(
|
||||
badgeColor: Colors.red,
|
||||
padding: const EdgeInsets.all(10),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
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),
|
||||
() => {BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const AssignedJobsPage())})
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
getDefaultButton(
|
||||
'Erledigte Aufträge',
|
||||
image: Image.asset('assets/erledigte_auftraege.png', width: 30, height: 30),
|
||||
() => {BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const FinishedJobsPage())}),
|
||||
const SizedBox(height: 10),
|
||||
getDefaultButton(
|
||||
'Nachrichten',
|
||||
image: Image.asset('assets/nachrichten.png', width: 30, height: 30),
|
||||
() => {BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const MessagesPage())}),
|
||||
ValueListenableBuilder<int>(
|
||||
valueListenable: _messagesValueNotifier,
|
||||
builder: (context, value, child) {
|
||||
return badges.Badge(
|
||||
showBadge: value > 0,
|
||||
position: badges.BadgePosition.topEnd(top: 0, end: -5),
|
||||
badgeContent: Text(
|
||||
value.toString(),
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 13.0,
|
||||
),
|
||||
),
|
||||
badgeStyle: badges.BadgeStyle(
|
||||
badgeColor: Colors.red,
|
||||
padding: const EdgeInsets.all(10),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
borderSide: const BorderSide(color: Colors.white, width: 0),
|
||||
elevation: 0,
|
||||
),
|
||||
child: getDefaultButton(
|
||||
'Nachrichten',
|
||||
image: Image.asset('assets/nachrichten.png', width: 30, height: 30),
|
||||
() => {BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const MessagesPage())})
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
getDefaultButton(
|
||||
'Anfahrtsbereich',
|
||||
@@ -126,10 +199,7 @@ class _MainPageState extends State<MainPage> {
|
||||
getDefaultButton(
|
||||
'Abmelden',
|
||||
image: Image.asset('assets/abmelden.png', width: 30, height: 30),
|
||||
() => {
|
||||
_test()
|
||||
//BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const FinishedJobsPage())
|
||||
}),
|
||||
() => {BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const FinishedJobsPage())}),
|
||||
Expanded(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
@@ -153,7 +223,7 @@ class _MainPageState extends State<MainPage> {
|
||||
);
|
||||
}
|
||||
|
||||
_test() async {
|
||||
/*_test() async {
|
||||
var json = await rootBundle.loadString('assets/job.json');
|
||||
var jsonMap = jsonDecode(json);
|
||||
var payload = jsonMap["payload"];
|
||||
@@ -167,11 +237,16 @@ class _MainPageState extends State<MainPage> {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
_initMessages() {
|
||||
BroadcastReceiver().subscribe<StatusInfoUpdate>(Constants.messageTopicStatusInfoUpdate, (statusInfoUpdate) {
|
||||
widget._sidValueNotifier.value = statusInfoUpdate.status.sid;
|
||||
});
|
||||
}
|
||||
|
||||
void _initBadges() async {
|
||||
_assignedJobsValueNotifier.value = await MyApp.isarInstance.jobs.filter().stateEqualTo(0).count();
|
||||
_acceptedJobsValueNotifier.value = await MyApp.isarInstance.jobs.filter().stateEqualTo(1).count();
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import 'package:stadtbote/content_views/utils/header_info.dart';
|
||||
import 'package:stadtbote/model/job_tour.dart';
|
||||
import 'package:stadtbote/popups/tasks_popups/arrived_popup.dart';
|
||||
import 'package:stadtbote/popups/tasks_popups/commision_number_popup.dart';
|
||||
import 'package:stadtbote/popups/tasks_popups/pickup_delivery_status_popup.dart';
|
||||
import 'package:stadtbote/popups/tasks_popups/receipt_giver_popup.dart';
|
||||
import 'package:stadtbote/popups/tasks_popups/scan_barcodes_popup.dart';
|
||||
import 'package:stadtbote/popups/tasks_popups/signature_popup.dart';
|
||||
@@ -217,6 +218,10 @@ class _TaskListPageState extends State<TaskListPage> {
|
||||
case 9:
|
||||
_processCommissionNumber(taskInfo);
|
||||
break;
|
||||
|
||||
case 11:
|
||||
_processPickupDeliveryStatusTask(taskInfo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,6 +317,16 @@ class _TaskListPageState extends State<TaskListPage> {
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
void _processPickupDeliveryStatusTask(TaskInfo taskInfo) {
|
||||
Future.delayed(const Duration(seconds: 1), () async {
|
||||
_popup = showPickupDeliveryStatusPopup(context, taskInfo, () => {
|
||||
_popup.dismiss(context),
|
||||
|
||||
taskInfo.completed = true,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void _processSignature(TaskInfo taskInfo) {
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft]);
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ class _TourListPageState extends State<TourListPage> {
|
||||
late List<Widget> jobWidgets = _createjobWidgets();
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
padding: const EdgeInsets.all(18.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
|
||||
@@ -23,6 +23,7 @@ class TourTask {
|
||||
late int? taskArrival;
|
||||
@JsonKey(name: 'task_fin_work')
|
||||
late int? taskFinWork;
|
||||
late List<String>? entries;
|
||||
|
||||
TourTask();
|
||||
|
||||
|
||||
+307
-47
@@ -13,68 +13,73 @@ const TourTaskSchema = Schema(
|
||||
name: r'TourTask',
|
||||
id: -3019997418839113825,
|
||||
properties: {
|
||||
r'max': PropertySchema(
|
||||
r'entries': PropertySchema(
|
||||
id: 0,
|
||||
name: r'entries',
|
||||
type: IsarType.stringList,
|
||||
),
|
||||
r'max': PropertySchema(
|
||||
id: 1,
|
||||
name: r'max',
|
||||
type: IsarType.long,
|
||||
),
|
||||
r'maxLen': PropertySchema(
|
||||
id: 1,
|
||||
id: 2,
|
||||
name: r'maxLen',
|
||||
type: IsarType.long,
|
||||
),
|
||||
r'min': PropertySchema(
|
||||
id: 2,
|
||||
id: 3,
|
||||
name: r'min',
|
||||
type: IsarType.long,
|
||||
),
|
||||
r'opt': PropertySchema(
|
||||
id: 3,
|
||||
id: 4,
|
||||
name: r'opt',
|
||||
type: IsarType.bool,
|
||||
),
|
||||
r'reenter': PropertySchema(
|
||||
id: 4,
|
||||
id: 5,
|
||||
name: r'reenter',
|
||||
type: IsarType.bool,
|
||||
),
|
||||
r'rt': PropertySchema(
|
||||
id: 5,
|
||||
id: 6,
|
||||
name: r'rt',
|
||||
type: IsarType.bool,
|
||||
),
|
||||
r'sId': PropertySchema(
|
||||
id: 6,
|
||||
id: 7,
|
||||
name: r'sId',
|
||||
type: IsarType.long,
|
||||
),
|
||||
r'taskArrival': PropertySchema(
|
||||
id: 7,
|
||||
id: 8,
|
||||
name: r'taskArrival',
|
||||
type: IsarType.long,
|
||||
),
|
||||
r'taskFinWork': PropertySchema(
|
||||
id: 8,
|
||||
id: 9,
|
||||
name: r'taskFinWork',
|
||||
type: IsarType.long,
|
||||
),
|
||||
r'topic': PropertySchema(
|
||||
id: 9,
|
||||
id: 10,
|
||||
name: r'topic',
|
||||
type: IsarType.string,
|
||||
),
|
||||
r'track': PropertySchema(
|
||||
id: 10,
|
||||
id: 11,
|
||||
name: r'track',
|
||||
type: IsarType.bool,
|
||||
),
|
||||
r'txt': PropertySchema(
|
||||
id: 11,
|
||||
id: 12,
|
||||
name: r'txt',
|
||||
type: IsarType.stringList,
|
||||
),
|
||||
r'type': PropertySchema(
|
||||
id: 12,
|
||||
id: 13,
|
||||
name: r'type',
|
||||
type: IsarType.long,
|
||||
)
|
||||
@@ -91,6 +96,18 @@ int _tourTaskEstimateSize(
|
||||
Map<Type, List<int>> allOffsets,
|
||||
) {
|
||||
var bytesCount = offsets.last;
|
||||
{
|
||||
final list = object.entries;
|
||||
if (list != null) {
|
||||
bytesCount += 3 + list.length * 3;
|
||||
{
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
final value = list[i];
|
||||
bytesCount += value.length * 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
bytesCount += 3 + object.topic.length * 3;
|
||||
{
|
||||
final list = object.txt;
|
||||
@@ -113,19 +130,20 @@ void _tourTaskSerialize(
|
||||
List<int> offsets,
|
||||
Map<Type, List<int>> allOffsets,
|
||||
) {
|
||||
writer.writeLong(offsets[0], object.max);
|
||||
writer.writeLong(offsets[1], object.maxLen);
|
||||
writer.writeLong(offsets[2], object.min);
|
||||
writer.writeBool(offsets[3], object.opt);
|
||||
writer.writeBool(offsets[4], object.reenter);
|
||||
writer.writeBool(offsets[5], object.rt);
|
||||
writer.writeLong(offsets[6], object.sId);
|
||||
writer.writeLong(offsets[7], object.taskArrival);
|
||||
writer.writeLong(offsets[8], object.taskFinWork);
|
||||
writer.writeString(offsets[9], object.topic);
|
||||
writer.writeBool(offsets[10], object.track);
|
||||
writer.writeStringList(offsets[11], object.txt);
|
||||
writer.writeLong(offsets[12], object.type);
|
||||
writer.writeStringList(offsets[0], object.entries);
|
||||
writer.writeLong(offsets[1], object.max);
|
||||
writer.writeLong(offsets[2], object.maxLen);
|
||||
writer.writeLong(offsets[3], object.min);
|
||||
writer.writeBool(offsets[4], object.opt);
|
||||
writer.writeBool(offsets[5], object.reenter);
|
||||
writer.writeBool(offsets[6], object.rt);
|
||||
writer.writeLong(offsets[7], object.sId);
|
||||
writer.writeLong(offsets[8], object.taskArrival);
|
||||
writer.writeLong(offsets[9], object.taskFinWork);
|
||||
writer.writeString(offsets[10], object.topic);
|
||||
writer.writeBool(offsets[11], object.track);
|
||||
writer.writeStringList(offsets[12], object.txt);
|
||||
writer.writeLong(offsets[13], object.type);
|
||||
}
|
||||
|
||||
TourTask _tourTaskDeserialize(
|
||||
@@ -135,19 +153,20 @@ TourTask _tourTaskDeserialize(
|
||||
Map<Type, List<int>> allOffsets,
|
||||
) {
|
||||
final object = TourTask();
|
||||
object.max = reader.readLongOrNull(offsets[0]);
|
||||
object.maxLen = reader.readLongOrNull(offsets[1]);
|
||||
object.min = reader.readLongOrNull(offsets[2]);
|
||||
object.opt = reader.readBoolOrNull(offsets[3]);
|
||||
object.reenter = reader.readBoolOrNull(offsets[4]);
|
||||
object.rt = reader.readBoolOrNull(offsets[5]);
|
||||
object.sId = reader.readLong(offsets[6]);
|
||||
object.taskArrival = reader.readLongOrNull(offsets[7]);
|
||||
object.taskFinWork = reader.readLongOrNull(offsets[8]);
|
||||
object.topic = reader.readString(offsets[9]);
|
||||
object.track = reader.readBoolOrNull(offsets[10]);
|
||||
object.txt = reader.readStringList(offsets[11]);
|
||||
object.type = reader.readLong(offsets[12]);
|
||||
object.entries = reader.readStringList(offsets[0]);
|
||||
object.max = reader.readLongOrNull(offsets[1]);
|
||||
object.maxLen = reader.readLongOrNull(offsets[2]);
|
||||
object.min = reader.readLongOrNull(offsets[3]);
|
||||
object.opt = reader.readBoolOrNull(offsets[4]);
|
||||
object.reenter = reader.readBoolOrNull(offsets[5]);
|
||||
object.rt = reader.readBoolOrNull(offsets[6]);
|
||||
object.sId = reader.readLong(offsets[7]);
|
||||
object.taskArrival = reader.readLongOrNull(offsets[8]);
|
||||
object.taskFinWork = reader.readLongOrNull(offsets[9]);
|
||||
object.topic = reader.readString(offsets[10]);
|
||||
object.track = reader.readBoolOrNull(offsets[11]);
|
||||
object.txt = reader.readStringList(offsets[12]);
|
||||
object.type = reader.readLong(offsets[13]);
|
||||
return object;
|
||||
}
|
||||
|
||||
@@ -159,30 +178,32 @@ P _tourTaskDeserializeProp<P>(
|
||||
) {
|
||||
switch (propertyId) {
|
||||
case 0:
|
||||
return (reader.readLongOrNull(offset)) as P;
|
||||
return (reader.readStringList(offset)) as P;
|
||||
case 1:
|
||||
return (reader.readLongOrNull(offset)) as P;
|
||||
case 2:
|
||||
return (reader.readLongOrNull(offset)) as P;
|
||||
case 3:
|
||||
return (reader.readBoolOrNull(offset)) as P;
|
||||
return (reader.readLongOrNull(offset)) as P;
|
||||
case 4:
|
||||
return (reader.readBoolOrNull(offset)) as P;
|
||||
case 5:
|
||||
return (reader.readBoolOrNull(offset)) as P;
|
||||
case 6:
|
||||
return (reader.readLong(offset)) as P;
|
||||
return (reader.readBoolOrNull(offset)) as P;
|
||||
case 7:
|
||||
return (reader.readLongOrNull(offset)) as P;
|
||||
return (reader.readLong(offset)) as P;
|
||||
case 8:
|
||||
return (reader.readLongOrNull(offset)) as P;
|
||||
case 9:
|
||||
return (reader.readString(offset)) as P;
|
||||
return (reader.readLongOrNull(offset)) as P;
|
||||
case 10:
|
||||
return (reader.readBoolOrNull(offset)) as P;
|
||||
return (reader.readString(offset)) as P;
|
||||
case 11:
|
||||
return (reader.readStringList(offset)) as P;
|
||||
return (reader.readBoolOrNull(offset)) as P;
|
||||
case 12:
|
||||
return (reader.readStringList(offset)) as P;
|
||||
case 13:
|
||||
return (reader.readLong(offset)) as P;
|
||||
default:
|
||||
throw IsarError('Unknown property with id $propertyId');
|
||||
@@ -191,6 +212,242 @@ P _tourTaskDeserializeProp<P>(
|
||||
|
||||
extension TourTaskQueryFilter
|
||||
on QueryBuilder<TourTask, TourTask, QFilterCondition> {
|
||||
QueryBuilder<TourTask, TourTask, QAfterFilterCondition> entriesIsNull() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(const FilterCondition.isNull(
|
||||
property: r'entries',
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<TourTask, TourTask, QAfterFilterCondition> entriesIsNotNull() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(const FilterCondition.isNotNull(
|
||||
property: r'entries',
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<TourTask, TourTask, QAfterFilterCondition> entriesElementEqualTo(
|
||||
String value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.equalTo(
|
||||
property: r'entries',
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<TourTask, TourTask, QAfterFilterCondition>
|
||||
entriesElementGreaterThan(
|
||||
String value, {
|
||||
bool include = false,
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.greaterThan(
|
||||
include: include,
|
||||
property: r'entries',
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<TourTask, TourTask, QAfterFilterCondition>
|
||||
entriesElementLessThan(
|
||||
String value, {
|
||||
bool include = false,
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.lessThan(
|
||||
include: include,
|
||||
property: r'entries',
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<TourTask, TourTask, QAfterFilterCondition> entriesElementBetween(
|
||||
String lower,
|
||||
String upper, {
|
||||
bool includeLower = true,
|
||||
bool includeUpper = true,
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.between(
|
||||
property: r'entries',
|
||||
lower: lower,
|
||||
includeLower: includeLower,
|
||||
upper: upper,
|
||||
includeUpper: includeUpper,
|
||||
caseSensitive: caseSensitive,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<TourTask, TourTask, QAfterFilterCondition>
|
||||
entriesElementStartsWith(
|
||||
String value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.startsWith(
|
||||
property: r'entries',
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<TourTask, TourTask, QAfterFilterCondition>
|
||||
entriesElementEndsWith(
|
||||
String value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.endsWith(
|
||||
property: r'entries',
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<TourTask, TourTask, QAfterFilterCondition>
|
||||
entriesElementContains(String value, {bool caseSensitive = true}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.contains(
|
||||
property: r'entries',
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<TourTask, TourTask, QAfterFilterCondition> entriesElementMatches(
|
||||
String pattern,
|
||||
{bool caseSensitive = true}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.matches(
|
||||
property: r'entries',
|
||||
wildcard: pattern,
|
||||
caseSensitive: caseSensitive,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<TourTask, TourTask, QAfterFilterCondition>
|
||||
entriesElementIsEmpty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.equalTo(
|
||||
property: r'entries',
|
||||
value: '',
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<TourTask, TourTask, QAfterFilterCondition>
|
||||
entriesElementIsNotEmpty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.greaterThan(
|
||||
property: r'entries',
|
||||
value: '',
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<TourTask, TourTask, QAfterFilterCondition> entriesLengthEqualTo(
|
||||
int length) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.listLength(
|
||||
r'entries',
|
||||
length,
|
||||
true,
|
||||
length,
|
||||
true,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<TourTask, TourTask, QAfterFilterCondition> entriesIsEmpty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.listLength(
|
||||
r'entries',
|
||||
0,
|
||||
true,
|
||||
0,
|
||||
true,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<TourTask, TourTask, QAfterFilterCondition> entriesIsNotEmpty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.listLength(
|
||||
r'entries',
|
||||
0,
|
||||
false,
|
||||
999999,
|
||||
true,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<TourTask, TourTask, QAfterFilterCondition> entriesLengthLessThan(
|
||||
int length, {
|
||||
bool include = false,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.listLength(
|
||||
r'entries',
|
||||
0,
|
||||
true,
|
||||
length,
|
||||
include,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<TourTask, TourTask, QAfterFilterCondition>
|
||||
entriesLengthGreaterThan(
|
||||
int length, {
|
||||
bool include = false,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.listLength(
|
||||
r'entries',
|
||||
length,
|
||||
include,
|
||||
999999,
|
||||
true,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<TourTask, TourTask, QAfterFilterCondition> entriesLengthBetween(
|
||||
int lower,
|
||||
int upper, {
|
||||
bool includeLower = true,
|
||||
bool includeUpper = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.listLength(
|
||||
r'entries',
|
||||
lower,
|
||||
includeLower,
|
||||
upper,
|
||||
includeUpper,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<TourTask, TourTask, QAfterFilterCondition> maxIsNull() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(const FilterCondition.isNull(
|
||||
@@ -1132,7 +1389,9 @@ TourTask _$TourTaskFromJson(Map<String, dynamic> json) => TourTask()
|
||||
..track = json['track'] as bool?
|
||||
..txt = (json['txt'] as List<dynamic>?)?.map((e) => e as String).toList()
|
||||
..taskArrival = json['task_arrival'] as int?
|
||||
..taskFinWork = json['task_fin_work'] as int?;
|
||||
..taskFinWork = json['task_fin_work'] as int?
|
||||
..entries =
|
||||
(json['entries'] as List<dynamic>?)?.map((e) => e as String).toList();
|
||||
|
||||
Map<String, dynamic> _$TourTaskToJson(TourTask instance) => <String, dynamic>{
|
||||
's_id': instance.sId,
|
||||
@@ -1148,4 +1407,5 @@ Map<String, dynamic> _$TourTaskToJson(TourTask instance) => <String, dynamic>{
|
||||
'txt': instance.txt,
|
||||
'task_arrival': instance.taskArrival,
|
||||
'task_fin_work': instance.taskFinWork,
|
||||
'entries': instance.entries,
|
||||
};
|
||||
@@ -0,0 +1,72 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:kumi_popup_window/kumi_popup_window.dart';
|
||||
import 'package:stadtbote/model/task_info.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()
|
||||
})
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
*/
|
||||
@@ -46,6 +46,9 @@ class MqttCore {
|
||||
String clientId = await Util.getAppUuid();
|
||||
Util.logInfo("client id: $clientId");
|
||||
|
||||
Util.logInfo("broker uri: $_brokerUri");
|
||||
Util.logInfo("broker port: $_brokerPort");
|
||||
|
||||
_mqttClient = MqttServerClient.withPort(_brokerUri, clientId, _brokerPort);
|
||||
_mqttClient.logging(on: false);
|
||||
_mqttClient.keepAlivePeriod = 20;
|
||||
@@ -55,8 +58,8 @@ class MqttCore {
|
||||
_mqttClient.connectionMessage = MqttConnectMessage()
|
||||
.withClientIdentifier('clientId')
|
||||
.withWillQos(MqttQos.atMostOnce)
|
||||
.withWillTopic('willTopic')
|
||||
.withWillMessage('willMessage')
|
||||
//.withWillTopic('willTopic')
|
||||
//.withWillMessage('willMessage')
|
||||
.authenticateAs("app", "apppwd");
|
||||
|
||||
await _mqttClient.connect();
|
||||
|
||||
Reference in new issue
Block a user