This commit is contained in:
1 parent
f89ca690c8
commit
96544ca924
22 files changed
+1026
-381
No files matched your search
@@ -5,4 +5,5 @@
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
</manifest>
|
||||
@@ -1,9 +1,12 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.assecutor.stadtbote">
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<application
|
||||
android:label="Stadtbote"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/launcher_icon">
|
||||
android:icon="@mipmap/launcher_icon"
|
||||
android:requestLegacyExternalStorage="true">
|
||||
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
|
||||
@@ -5,4 +5,5 @@
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
</manifest>
|
||||
@@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:stadtbote/content_views/tour_list_page.dart';
|
||||
import 'package:stadtbote/content_views/utils/content_view_widget.dart';
|
||||
import 'package:stadtbote/content_views/utils/header_info.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:stadtbote/messages/pop_content_view_message.dart';
|
||||
import 'package:stadtbote/tools/message_service.dart';
|
||||
|
||||
import '../main.dart';
|
||||
@@ -18,21 +18,10 @@ class AcceptedJobsPage extends ContentViewWidget {
|
||||
State<AcceptedJobsPage> createState() => _AcceptedJobsPageState();
|
||||
|
||||
@override
|
||||
Future<HeaderInfo> getHeaderInfo(BuildContext context) async {
|
||||
return HeaderInfo(
|
||||
titleWidget: const Text(
|
||||
'Angenommene Aufträge',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
),
|
||||
rightButtonEnabled: false,
|
||||
rightButtonVisible: false,
|
||||
rightButtonImage: null,
|
||||
rightButtonOnPressed: () async {
|
||||
//BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: EmployeeEditProfileWidget());
|
||||
});
|
||||
Future<Widget> getHeaderWidget(BuildContext context) async {
|
||||
await Future.delayed(const Duration(microseconds: 0));
|
||||
|
||||
return _HeaderWidget();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,3 +135,90 @@ class _AcceptedJobsPageState extends State<AcceptedJobsPage> {
|
||||
await MessageService().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: TourListPage(job: job));
|
||||
}
|
||||
}
|
||||
|
||||
class _HeaderWidget extends StatefulWidget {
|
||||
@override
|
||||
State<_HeaderWidget> createState() => _HeaderWidgetState();
|
||||
}
|
||||
|
||||
class _HeaderWidgetState extends State<_HeaderWidget> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var cellWidth = (MediaQuery.of(context).size.width - 60 - 60 - 25) / 2;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Visibility(
|
||||
visible: true,
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.white,
|
||||
),
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
await MessageService().publish<PopContentViewMessage>(Constants.messageTopicPopContentView, arguments: PopContentViewMessage(count: 1));
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
radius: 10,
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
child: Padding(padding: EdgeInsets.all(1.0), child: Icon(Icons.arrow_back, size: 20.0, color: Colors.white)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: false,
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.red,
|
||||
),
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
await MessageService().publish<PopContentViewMessage>(Constants.messageTopicPopContentView, arguments: PopContentViewMessage(count: 1));
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
radius: 10,
|
||||
child: Padding(padding: EdgeInsets.all(1.0), child: Icon(Icons.info_outline, size: 20.0, color: Colors.white))),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 100,
|
||||
width: cellWidth * 2,
|
||||
child: const Center(
|
||||
child: Text(
|
||||
textAlign: TextAlign.center,
|
||||
"Angenommene Aufträge",
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:mqtt5_client/mqtt5_client.dart';
|
||||
import 'package:stadtbote/content_views/utils/content_view_widget.dart';
|
||||
import 'package:stadtbote/content_views/utils/header_info.dart';
|
||||
import 'package:stadtbote/main.dart';
|
||||
import 'package:stadtbote/messages/pop_content_view_message.dart';
|
||||
import 'package:stadtbote/model/rank.dart';
|
||||
import 'package:stadtbote/popups/tasks_popups/zip_popup.dart';
|
||||
import 'package:stadtbote/protocoll_messages/zip_message.dart';
|
||||
@@ -23,21 +23,10 @@ class ApproachAreaPage extends ContentViewWidget {
|
||||
State<ApproachAreaPage> createState() => _ApproachAreaPageState();
|
||||
|
||||
@override
|
||||
Future<HeaderInfo> getHeaderInfo(BuildContext context) async {
|
||||
return HeaderInfo(
|
||||
titleWidget: const Text(
|
||||
'Anfahrtsbereich',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
),
|
||||
rightButtonEnabled: true,
|
||||
rightButtonVisible: true,
|
||||
rightButtonImage: Util.fetchFutureIcon(const Icon(Icons.help_outline, size: 20.0, color: Colors.white)),
|
||||
rightButtonOnPressed: () async {
|
||||
await Util.startBrowser('https://app.assecutor.de/help/sb/app/context/001/index.html');
|
||||
});
|
||||
Future<Widget> getHeaderWidget(BuildContext context) async {
|
||||
await Future.delayed(const Duration(microseconds: 0));
|
||||
|
||||
return _HeaderWidget();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,3 +212,90 @@ class _ApproachAreaPageState extends State<ApproachAreaPage> {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class _HeaderWidget extends StatefulWidget {
|
||||
@override
|
||||
State<_HeaderWidget> createState() => _HeaderWidgetState();
|
||||
}
|
||||
|
||||
class _HeaderWidgetState extends State<_HeaderWidget> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var cellWidth = (MediaQuery.of(context).size.width - 60 - 60 - 25) / 2;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Visibility(
|
||||
visible: true,
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.white,
|
||||
),
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
await MessageService().publish<PopContentViewMessage>(Constants.messageTopicPopContentView, arguments: PopContentViewMessage(count: 1));
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
radius: 10,
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
child: Padding(padding: EdgeInsets.all(1.0), child: Icon(Icons.arrow_back, size: 20.0, color: Colors.white)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: false,
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.red,
|
||||
),
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
await MessageService().publish<PopContentViewMessage>(Constants.messageTopicPopContentView, arguments: PopContentViewMessage(count: 1));
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
radius: 10,
|
||||
child: Padding(padding: EdgeInsets.all(1.0), child: Icon(Icons.info_outline, size: 20.0, color: Colors.white))),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 100,
|
||||
width: cellWidth * 2,
|
||||
child: const Center(
|
||||
child: Text(
|
||||
textAlign: TextAlign.center,
|
||||
"Anfahrtsbereich",
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,9 @@ import 'package:flutter/material.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:mqtt5_client/mqtt5_client.dart';
|
||||
import 'package:stadtbote/content_views/utils/content_view_widget.dart';
|
||||
import 'package:stadtbote/content_views/utils/header_info.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:badges/badges.dart' as badges;
|
||||
import 'package:stadtbote/messages/pop_content_view_message.dart';
|
||||
import 'package:stadtbote/protocoll_messages/accept_job_message.dart';
|
||||
import 'package:stadtbote/protocoll_messages/fin_task_message.dart';
|
||||
import 'package:stadtbote/tools/message_service.dart';
|
||||
@@ -25,21 +25,10 @@ class AssignedJobsPage extends ContentViewWidget {
|
||||
State<AssignedJobsPage> createState() => _AssignedJobsPageState();
|
||||
|
||||
@override
|
||||
Future<HeaderInfo> getHeaderInfo(BuildContext context) async {
|
||||
return HeaderInfo(
|
||||
titleWidget: const Text(
|
||||
'Zugewiesene Aufträge',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
),
|
||||
rightButtonEnabled: false,
|
||||
rightButtonVisible: false,
|
||||
rightButtonImage: null,
|
||||
rightButtonOnPressed: () async {
|
||||
//BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: EmployeeEditProfileWidget());
|
||||
});
|
||||
Future<Widget> getHeaderWidget(BuildContext context) async {
|
||||
await Future.delayed(const Duration(microseconds: 0));
|
||||
|
||||
return _HeaderWidget();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,3 +204,90 @@ class _AssignedJobsPageState extends State<AssignedJobsPage> {
|
||||
|
||||
void _initMessages() {}
|
||||
}
|
||||
|
||||
class _HeaderWidget extends StatefulWidget {
|
||||
@override
|
||||
State<_HeaderWidget> createState() => _HeaderWidgetState();
|
||||
}
|
||||
|
||||
class _HeaderWidgetState extends State<_HeaderWidget> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var cellWidth = (MediaQuery.of(context).size.width - 60 - 60 - 25) / 2;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Visibility(
|
||||
visible: true,
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.white,
|
||||
),
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
await MessageService().publish<PopContentViewMessage>(Constants.messageTopicPopContentView, arguments: PopContentViewMessage(count: 1));
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
radius: 10,
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
child: Padding(padding: EdgeInsets.all(1.0), child: Icon(Icons.arrow_back, size: 20.0, color: Colors.white)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: false,
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.red,
|
||||
),
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
await MessageService().publish<PopContentViewMessage>(Constants.messageTopicPopContentView, arguments: PopContentViewMessage(count: 1));
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
radius: 10,
|
||||
child: Padding(padding: EdgeInsets.all(1.0), child: Icon(Icons.info_outline, size: 20.0, color: Colors.white))),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 100,
|
||||
width: cellWidth * 2,
|
||||
child: const Center(
|
||||
child: Text(
|
||||
textAlign: TextAlign.center,
|
||||
"Zugewiesene Aufträge",
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:stadtbote/content_views/tour_list_page.dart';
|
||||
import 'package:stadtbote/content_views/utils/content_view_widget.dart';
|
||||
import 'package:stadtbote/content_views/utils/header_info.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:stadtbote/messages/pop_content_view_message.dart';
|
||||
import 'package:stadtbote/tools/message_service.dart';
|
||||
|
||||
import '../main.dart';
|
||||
@@ -18,21 +18,10 @@ class FinishedJobsPage extends ContentViewWidget {
|
||||
State<FinishedJobsPage> createState() => _FinishedJobsPageState();
|
||||
|
||||
@override
|
||||
Future<HeaderInfo> getHeaderInfo(BuildContext context) async {
|
||||
return HeaderInfo(
|
||||
titleWidget: const Text(
|
||||
'Erledigte Aufträge',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
),
|
||||
rightButtonEnabled: false,
|
||||
rightButtonVisible: false,
|
||||
rightButtonImage: null,
|
||||
rightButtonOnPressed: () async {
|
||||
//BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: EmployeeEditProfileWidget());
|
||||
});
|
||||
Future<Widget> getHeaderWidget(BuildContext context) async {
|
||||
await Future.delayed(const Duration(microseconds: 0));
|
||||
|
||||
return _HeaderWidget();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,3 +123,90 @@ class _FinishedJobsPageState extends State<FinishedJobsPage> {
|
||||
await MessageService().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: TourListPage(job: job, readOnly: true,));
|
||||
}
|
||||
}
|
||||
|
||||
class _HeaderWidget extends StatefulWidget {
|
||||
@override
|
||||
State<_HeaderWidget> createState() => _HeaderWidgetState();
|
||||
}
|
||||
|
||||
class _HeaderWidgetState extends State<_HeaderWidget> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var cellWidth = (MediaQuery.of(context).size.width - 60 - 60 - 25) / 2;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Visibility(
|
||||
visible: true,
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.white,
|
||||
),
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
await MessageService().publish<PopContentViewMessage>(Constants.messageTopicPopContentView, arguments: PopContentViewMessage(count: 1));
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
radius: 10,
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
child: Padding(padding: EdgeInsets.all(1.0), child: Icon(Icons.arrow_back, size: 20.0, color: Colors.white)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: false,
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.red,
|
||||
),
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
await MessageService().publish<PopContentViewMessage>(Constants.messageTopicPopContentView, arguments: PopContentViewMessage(count: 1));
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
radius: 10,
|
||||
child: Padding(padding: EdgeInsets.all(1.0), child: Icon(Icons.info_outline, size: 20.0, color: Colors.white))),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 100,
|
||||
width: cellWidth * 2,
|
||||
child: const Center(
|
||||
child: Text(
|
||||
textAlign: TextAlign.center,
|
||||
"Erledigte Aufträge",
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -7,78 +7,38 @@ 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/main.dart';
|
||||
import 'package:stadtbote/model/job.dart';
|
||||
import 'package:stadtbote/model/location_status.dart';
|
||||
import 'package:stadtbote/model/message.dart';
|
||||
import 'package:stadtbote/model/session_status.dart';
|
||||
import 'package:stadtbote/model/location_status.dart';
|
||||
import 'package:stadtbote/popups/infos_popup.dart';
|
||||
import 'package:stadtbote/protocoll_messages/logout_message.dart';
|
||||
import 'package:stadtbote/tools/constants.dart';
|
||||
import 'package:stadtbote/tools/message_service.dart';
|
||||
import 'package:stadtbote/tools/messages/publish_payload_message.dart';
|
||||
import 'package:stadtbote/tools/messages/connect_client_message.dart';
|
||||
import 'package:stadtbote/tools/messages/disconnect_client_message.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/publish_payload_message.dart';
|
||||
import 'package:stadtbote/tools/messages/connect_client_message.dart';
|
||||
import 'package:stadtbote/tools/messages/disconnect_client_message.dart';
|
||||
import 'package:stadtbote/tools/messages/refresh_badges_message.dart';
|
||||
import 'package:stadtbote/tools/messages/session_info_update.dart';
|
||||
import 'package:badges/badges.dart' as badges;
|
||||
import 'package:stadtbote/tools/messages/status_info_update.dart';
|
||||
import 'package:stadtbote/tools/messages/refresh_badges_message.dart';
|
||||
|
||||
import '../main.dart';
|
||||
import '../tools/constants.dart';
|
||||
import '../tools/util.dart';
|
||||
import 'package:stadtbote/tools/util.dart';
|
||||
|
||||
class MainPage extends ContentViewWidget {
|
||||
final ValueNotifier<String> _zipValueNotifier = ValueNotifier("-----");
|
||||
final ValueNotifier<String> sidValueNotifier = ValueNotifier("-----");
|
||||
|
||||
MainPage({super.key});
|
||||
const MainPage({super.key});
|
||||
|
||||
@override
|
||||
State<MainPage> createState() => _MainPageState();
|
||||
|
||||
@override
|
||||
Future<HeaderInfo> getHeaderInfo(BuildContext context) async {
|
||||
return HeaderInfo(
|
||||
titleWidget: Container(
|
||||
height: 100,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 0),
|
||||
child: Column(children: [
|
||||
ValueListenableBuilder<String>(
|
||||
valueListenable: _zipValueNotifier,
|
||||
builder: (context, value, child) {
|
||||
return Text(
|
||||
value,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 25.0,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
ValueListenableBuilder<String>(
|
||||
valueListenable: sidValueNotifier,
|
||||
builder: (context, value, child) {
|
||||
return Text(
|
||||
value,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 25.0,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
]),
|
||||
),
|
||||
rightButtonEnabled: true,
|
||||
rightButtonVisible: true,
|
||||
rightButtonImage: Util.fetchFutureIcon(const Icon(Icons.info_outline, size: 20.0, color: Colors.white)),
|
||||
rightButtonOnPressed: () async {
|
||||
showInfosPopup(await MyApp.isarInstance.sessionStatus.where().findFirst());
|
||||
});
|
||||
Future<Widget> getHeaderWidget(BuildContext context) async {
|
||||
await Future.delayed(const Duration(microseconds: 0));
|
||||
|
||||
return _HeaderWidget();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,8 +53,6 @@ class _MainPageState extends State<MainPage> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_updateHeader();
|
||||
|
||||
_refreshBadges();
|
||||
|
||||
_initMessages();
|
||||
@@ -144,7 +102,8 @@ class _MainPageState extends State<MainPage> {
|
||||
'Zugewiesene Aufträge',
|
||||
image: Image.asset('assets/zugewiesene_auftraege.png', width: 30, height: 30),
|
||||
() async => {
|
||||
await MessageService().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const AssignedJobsPage())
|
||||
await MessageService()
|
||||
.publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const AssignedJobsPage())
|
||||
}),
|
||||
);
|
||||
},
|
||||
@@ -177,7 +136,8 @@ class _MainPageState extends State<MainPage> {
|
||||
'Angenommene Aufträge',
|
||||
image: Image.asset('assets/angenommene_auftraege.png', width: 30, height: 30),
|
||||
() async => {
|
||||
await MessageService().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const AcceptedJobsPage())
|
||||
await MessageService()
|
||||
.publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const AcceptedJobsPage())
|
||||
}));
|
||||
},
|
||||
),
|
||||
@@ -188,7 +148,10 @@ class _MainPageState extends State<MainPage> {
|
||||
child: getDefaultButton(
|
||||
'Erledigte Aufträge',
|
||||
image: Image.asset('assets/erledigte_auftraege.png', width: 30, height: 30),
|
||||
() async => {await MessageService().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const FinishedJobsPage())}),
|
||||
() async => {
|
||||
await MessageService()
|
||||
.publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const FinishedJobsPage())
|
||||
}),
|
||||
),
|
||||
SizedBox(height: _loggedOut == true ? 0 : 20),
|
||||
Visibility(
|
||||
@@ -216,8 +179,10 @@ class _MainPageState extends State<MainPage> {
|
||||
child: getDefaultButton(
|
||||
'Nachrichten',
|
||||
image: Image.asset('assets/nachrichten.png', width: 30, height: 30),
|
||||
() async =>
|
||||
{await MessageService().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const MessagesPage())}));
|
||||
() async => {
|
||||
await MessageService()
|
||||
.publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const MessagesPage())
|
||||
}));
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -227,15 +192,16 @@ class _MainPageState extends State<MainPage> {
|
||||
child: getDefaultButton(
|
||||
'Anfahrtsbereich',
|
||||
image: Image.asset('assets/anfahrtsbereich.png', width: 30, height: 30),
|
||||
() async => {await MessageService().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const ApproachAreaPage())}),
|
||||
() async => {
|
||||
await MessageService()
|
||||
.publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const ApproachAreaPage())
|
||||
}),
|
||||
),
|
||||
SizedBox(height: _loggedOut == true ? 0 : 20),
|
||||
getDefaultButton(
|
||||
_loggedOut ? 'Anmelden' : 'Abmelden',
|
||||
image: Image.asset(_loggedOut ? 'assets/anmelden.png' : 'assets/abmelden.png', width: 30, height: 30),
|
||||
() async {
|
||||
_logout(context);
|
||||
}),
|
||||
getDefaultButton(_loggedOut ? 'Anmelden' : 'Abmelden',
|
||||
image: Image.asset(_loggedOut ? 'assets/anmelden.png' : 'assets/abmelden.png', width: 30, height: 30), () async {
|
||||
_logout(context);
|
||||
}),
|
||||
Expanded(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
@@ -260,14 +226,6 @@ class _MainPageState extends State<MainPage> {
|
||||
}
|
||||
|
||||
_initMessages() {
|
||||
MessageService().subscribe<SessionStatusInfoUpdate>(Constants.messageTopicSessionStatusInfoUpdate, this, (sessionStatusInfoUpdateMessage) {
|
||||
widget.sidValueNotifier.value = sessionStatusInfoUpdateMessage.status.sid;
|
||||
});
|
||||
|
||||
MessageService().subscribe<LocationStatusUpdate>(Constants.messageTopicLocationStatusUpdated, this, (statusInfoUpdateMessage) {
|
||||
_updateHeader();
|
||||
});
|
||||
|
||||
MessageService().subscribe<JobReceivedMessage>(Constants.messageTopicJobReceived, this, (JobReceivedMessage jobReceivedMessage) {
|
||||
_jobReceived(jobReceivedMessage.job);
|
||||
});
|
||||
@@ -286,9 +244,7 @@ class _MainPageState extends State<MainPage> {
|
||||
}
|
||||
|
||||
void _exitMessages() {
|
||||
MessageService().unsubscribe<SessionStatusInfoUpdate>(Constants.messageTopicSessionStatusInfoUpdate, this);
|
||||
|
||||
MessageService().unsubscribe<SessionStatusInfoUpdate>(Constants.messageTopicJobReceived, this);
|
||||
MessageService().unsubscribeAll(this);
|
||||
}
|
||||
|
||||
void _refreshBadges() async {
|
||||
@@ -301,19 +257,6 @@ class _MainPageState extends State<MainPage> {
|
||||
_refreshBadges();
|
||||
}
|
||||
|
||||
void _updateHeader() async {
|
||||
var status = await MyApp.isarInstance.locationStatus.where().findFirst();
|
||||
var sessionStatus = await MyApp.isarInstance.sessionStatus.where().findFirst();
|
||||
|
||||
if (status != null) {
|
||||
widget._zipValueNotifier.value = '${status.zip} (${status.zipReal})';
|
||||
} else if (sessionStatus != null) {
|
||||
widget._zipValueNotifier.value = sessionStatus.locZip;
|
||||
} else {
|
||||
widget._zipValueNotifier.value = "---";
|
||||
}
|
||||
}
|
||||
|
||||
_logout(context) async {
|
||||
if (!_loggedOut) {
|
||||
showLogoutAlertDialog(context);
|
||||
@@ -341,7 +284,6 @@ class _MainPageState extends State<MainPage> {
|
||||
await MessageService().publish<DisconnectClientMessage>(Constants.messageTopicDisconnectClient, arguments: DisconnectClientMessage());
|
||||
|
||||
Future.delayed(const Duration(seconds: 5), () async {
|
||||
|
||||
Navigator.of(context).pop();
|
||||
|
||||
setState(() {});
|
||||
@@ -361,7 +303,8 @@ class _MainPageState extends State<MainPage> {
|
||||
title: const Text("Warnung"),
|
||||
content: const Text("Wollen Sie sich wirklich abmelden?"),
|
||||
actions: [
|
||||
yesButton, noButton,
|
||||
yesButton,
|
||||
noButton,
|
||||
],
|
||||
);
|
||||
|
||||
@@ -386,6 +329,207 @@ class _MainPageState extends State<MainPage> {
|
||||
logoutMessage.pos!.acc = position.accuracy.toInt();
|
||||
}
|
||||
|
||||
await MessageService().publish<PublishPayloadMessage>(Constants.messageTopicPublishPayload, arguments: PublishPayloadMessage(topic: "logout", message: logoutMessage.toJson(), qos: MqttQos.exactlyOnce));
|
||||
await MessageService().publish<PublishPayloadMessage>(Constants.messageTopicPublishPayload,
|
||||
arguments: PublishPayloadMessage(topic: "logout", message: logoutMessage.toJson(), qos: MqttQos.exactlyOnce));
|
||||
}
|
||||
}
|
||||
|
||||
class _HeaderWidget extends StatefulWidget {
|
||||
@override
|
||||
State<_HeaderWidget> createState() => _HeaderWidgetState();
|
||||
}
|
||||
|
||||
class _HeaderWidgetState extends State<_HeaderWidget> {
|
||||
final ValueNotifier<String> _zipValueNotifier = ValueNotifier("-----");
|
||||
final ValueNotifier<String> _zipRealValueNotifier = ValueNotifier("-----");
|
||||
final ValueNotifier<String> _sidValueNotifier = ValueNotifier("-----");
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_updateHeader();
|
||||
|
||||
_initMessages();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var cellWidth = (MediaQuery.of(context).size.width - 60 - 60 - 25) / 2;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Visibility(
|
||||
visible: false,
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.white,
|
||||
),
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
radius: 10,
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
child: Padding(padding: EdgeInsets.all(1.0), child: Icon(Icons.info_outline, size: 20.0, color: Colors.white)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: true,
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.red,
|
||||
),
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
var sessionStatus = await MyApp.isarInstance.sessionStatus.where().findFirst();
|
||||
|
||||
showInfosPopup(sessionStatus);
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
radius: 10,
|
||||
child: Padding(padding: EdgeInsets.all(1.0), child: Icon(Icons.info_outline, size: 20.0, color: Colors.white))),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 100,
|
||||
width: cellWidth * 2,
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, // Verteilt die Texte gleichmäßig in der Zeile
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: cellWidth,
|
||||
child: const Text(
|
||||
'Meldung',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 11, color: Colors.white),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: cellWidth,
|
||||
child: const Text(
|
||||
'Ortung',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 11, color: Colors.white),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, // Verteilt die Texte gleichmäßig in der Zeile
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: cellWidth,
|
||||
child: ValueListenableBuilder<String>(
|
||||
valueListenable: _zipValueNotifier,
|
||||
builder: (context, value, child) {
|
||||
return Text(
|
||||
textAlign: TextAlign.center,
|
||||
value,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: Colors.white),
|
||||
);
|
||||
},
|
||||
)
|
||||
),
|
||||
SizedBox(
|
||||
width: cellWidth,
|
||||
child: ValueListenableBuilder<String>(
|
||||
valueListenable: _zipRealValueNotifier,
|
||||
builder: (context, value, child) {
|
||||
return Text(
|
||||
textAlign: TextAlign.center,
|
||||
value,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: Colors.white),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
const Text(
|
||||
'Kurierkennung',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 11, color: Colors.white),
|
||||
),
|
||||
ValueListenableBuilder<String>(
|
||||
valueListenable: _sidValueNotifier,
|
||||
builder: (context, value, child) {
|
||||
return Text(
|
||||
textAlign: TextAlign.center,
|
||||
value,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: Colors.white),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_initMessages() {
|
||||
MessageService().subscribe<SessionStatusInfoUpdate>(Constants.messageTopicSessionStatusInfoUpdate, this, (sessionStatusInfoUpdateMessage) {
|
||||
_updateHeader();
|
||||
});
|
||||
|
||||
MessageService().subscribe<LocationStatusUpdate>(Constants.messageTopicLocationStatusUpdated, this, (statusInfoUpdateMessage) {
|
||||
_updateHeader();
|
||||
});
|
||||
}
|
||||
|
||||
_updateHeader() async {
|
||||
var status = await MyApp.isarInstance.locationStatus.where().findFirst();
|
||||
var sessionStatus = await MyApp.isarInstance.sessionStatus.where().findFirst();
|
||||
|
||||
if (status != null) {
|
||||
_zipValueNotifier.value = status.zip;
|
||||
_zipRealValueNotifier.value = status.zipReal;
|
||||
} else if (sessionStatus != null) {
|
||||
_zipValueNotifier.value = sessionStatus.locZip;
|
||||
_zipRealValueNotifier.value = '---';
|
||||
} else {
|
||||
_zipValueNotifier.value = '---';
|
||||
_zipRealValueNotifier.value = '---';
|
||||
}
|
||||
if (sessionStatus != null) {
|
||||
_sidValueNotifier.value = sessionStatus.sid;
|
||||
}
|
||||
|
||||
/*
|
||||
rightButtonImage: Util.fetchFutureIcon(const Icon(Icons.info_outline, size: 20.0, color: Colors.white)),
|
||||
rightButtonOnPressed: () async {
|
||||
showInfosPopup(await MyApp.isarInstance.sessionStatus.where().findFirst());
|
||||
});
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,8 @@ import 'package:flutter_chat_types/flutter_chat_types.dart' as types;
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:mqtt5_client/mqtt5_client.dart';
|
||||
import 'package:stadtbote/content_views/utils/content_view_widget.dart';
|
||||
import 'package:stadtbote/content_views/utils/header_info.dart';
|
||||
import 'package:stadtbote/main.dart';
|
||||
import 'package:stadtbote/messages/pop_content_view_message.dart';
|
||||
import 'package:stadtbote/model/message.dart' as sbmessage;
|
||||
import 'package:stadtbote/model/message.dart';
|
||||
import 'package:stadtbote/model/session_status.dart';
|
||||
@@ -23,21 +23,10 @@ class MessagesPage extends ContentViewWidget {
|
||||
State<MessagesPage> createState() => _MessagesPageState();
|
||||
|
||||
@override
|
||||
Future<HeaderInfo> getHeaderInfo(BuildContext context) async {
|
||||
return HeaderInfo(
|
||||
titleWidget: const Text(
|
||||
'Nachrichten',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
),
|
||||
rightButtonEnabled: true,
|
||||
rightButtonVisible: true,
|
||||
rightButtonImage: Util.fetchFutureIcon(const Icon(Icons.help_outline, size: 20.0, color: Colors.white)),
|
||||
rightButtonOnPressed: () async {
|
||||
await Util.startBrowser('https://app.assecutor.de/help/sb/app/context/003/index.html');
|
||||
});
|
||||
Future<Widget> getHeaderWidget(BuildContext context) async {
|
||||
await Future.delayed(const Duration(microseconds: 0));
|
||||
|
||||
return _HeaderWidget();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,3 +186,90 @@ class _MessagesPageState extends State<MessagesPage> {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class _HeaderWidget extends StatefulWidget {
|
||||
@override
|
||||
State<_HeaderWidget> createState() => _HeaderWidgetState();
|
||||
}
|
||||
|
||||
class _HeaderWidgetState extends State<_HeaderWidget> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var cellWidth = (MediaQuery.of(context).size.width - 60 - 60 - 25) / 2;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Visibility(
|
||||
visible: true,
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.white,
|
||||
),
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
await MessageService().publish<PopContentViewMessage>(Constants.messageTopicPopContentView, arguments: PopContentViewMessage(count: 1));
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
radius: 10,
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
child: Padding(padding: EdgeInsets.all(1.0), child: Icon(Icons.arrow_back, size: 20.0, color: Colors.white)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: false,
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.red,
|
||||
),
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
await MessageService().publish<PopContentViewMessage>(Constants.messageTopicPopContentView, arguments: PopContentViewMessage(count: 1));
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
radius: 10,
|
||||
child: Padding(padding: EdgeInsets.all(1.0), child: Icon(Icons.info_outline, size: 20.0, color: Colors.white))),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 100,
|
||||
width: cellWidth * 2,
|
||||
child: const Center(
|
||||
child: Text(
|
||||
textAlign: TextAlign.center,
|
||||
"Nachrichten",
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import 'package:intl/intl.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:mqtt5_client/mqtt5_client.dart';
|
||||
import 'package:stadtbote/content_views/utils/content_view_widget.dart';
|
||||
import 'package:stadtbote/content_views/utils/header_info.dart';
|
||||
import 'package:stadtbote/messages/pop_content_view_message.dart';
|
||||
import 'package:stadtbote/model/job.dart';
|
||||
import 'package:stadtbote/model/job_tour.dart';
|
||||
@@ -44,21 +43,10 @@ class TaskListPage extends ContentViewWidget {
|
||||
State<TaskListPage> createState() => _TaskListPageState();
|
||||
|
||||
@override
|
||||
Future<HeaderInfo> getHeaderInfo(BuildContext context) async {
|
||||
return HeaderInfo(
|
||||
titleWidget: const Text(
|
||||
'Liste der Aufgaben',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
),
|
||||
rightButtonEnabled: true,
|
||||
rightButtonVisible: true,
|
||||
rightButtonImage: Util.fetchFutureIcon(const Icon(Icons.help_outline, size: 20.0, color: Colors.white)),
|
||||
rightButtonOnPressed: () async {
|
||||
await Util.startBrowser('https://app.assecutor.de/help/sb/app/context/002/index.html');
|
||||
});
|
||||
Future<Widget> getHeaderWidget(BuildContext context) async {
|
||||
await Future.delayed(const Duration(microseconds: 0));
|
||||
|
||||
return _HeaderWidget();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -581,3 +569,90 @@ class _TaskListPageState extends State<TaskListPage> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class _HeaderWidget extends StatefulWidget {
|
||||
@override
|
||||
State<_HeaderWidget> createState() => _HeaderWidgetState();
|
||||
}
|
||||
|
||||
class _HeaderWidgetState extends State<_HeaderWidget> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var cellWidth = (MediaQuery.of(context).size.width - 60 - 60 - 25) / 2;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Visibility(
|
||||
visible: true,
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.white,
|
||||
),
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
await MessageService().publish<PopContentViewMessage>(Constants.messageTopicPopContentView, arguments: PopContentViewMessage(count: 1));
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
radius: 10,
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
child: Padding(padding: EdgeInsets.all(1.0), child: Icon(Icons.arrow_back, size: 20.0, color: Colors.white)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: false,
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.red,
|
||||
),
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
await MessageService().publish<PopContentViewMessage>(Constants.messageTopicPopContentView, arguments: PopContentViewMessage(count: 1));
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
radius: 10,
|
||||
child: Padding(padding: EdgeInsets.all(1.0), child: Icon(Icons.info_outline, size: 20.0, color: Colors.white))),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 100,
|
||||
width: cellWidth * 2,
|
||||
child: const Center(
|
||||
child: Text(
|
||||
textAlign: TextAlign.center,
|
||||
"Liste der Aufgaben",
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stadtbote/content_views/task_list_page.dart';
|
||||
import 'package:stadtbote/content_views/utils/content_view_widget.dart';
|
||||
import 'package:stadtbote/content_views/utils/header_info.dart';
|
||||
import 'package:stadtbote/messages/pop_content_view_message.dart';
|
||||
import 'package:stadtbote/model/job_tour.dart';
|
||||
import 'package:stadtbote/tools/message_service.dart';
|
||||
|
||||
@@ -23,21 +23,10 @@ class TourDetailsPage extends ContentViewWidget {
|
||||
State<TourDetailsPage> createState() => _TourDetailsPageState();
|
||||
|
||||
@override
|
||||
Future<HeaderInfo> getHeaderInfo(BuildContext context) async {
|
||||
return HeaderInfo(
|
||||
titleWidget: const Text(
|
||||
'Details der Station',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
),
|
||||
rightButtonEnabled: false,
|
||||
rightButtonVisible: false,
|
||||
rightButtonImage: null,
|
||||
rightButtonOnPressed: () async {
|
||||
//BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: EmployeeEditProfileWidget());
|
||||
});
|
||||
Future<Widget> getHeaderWidget(BuildContext context) async {
|
||||
await Future.delayed(const Duration(microseconds: 0));
|
||||
|
||||
return _HeaderWidget();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,3 +140,90 @@ class _TourDetailsPageState extends State<TourDetailsPage> {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _HeaderWidget extends StatefulWidget {
|
||||
@override
|
||||
State<_HeaderWidget> createState() => _HeaderWidgetState();
|
||||
}
|
||||
|
||||
class _HeaderWidgetState extends State<_HeaderWidget> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var cellWidth = (MediaQuery.of(context).size.width - 60 - 60 - 25) / 2;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Visibility(
|
||||
visible: true,
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.white,
|
||||
),
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
await MessageService().publish<PopContentViewMessage>(Constants.messageTopicPopContentView, arguments: PopContentViewMessage(count: 1));
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
radius: 10,
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
child: Padding(padding: EdgeInsets.all(1.0), child: Icon(Icons.arrow_back, size: 20.0, color: Colors.white)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: false,
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.red,
|
||||
),
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
await MessageService().publish<PopContentViewMessage>(Constants.messageTopicPopContentView, arguments: PopContentViewMessage(count: 1));
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
radius: 10,
|
||||
child: Padding(padding: EdgeInsets.all(1.0), child: Icon(Icons.info_outline, size: 20.0, color: Colors.white))),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 100,
|
||||
width: cellWidth * 2,
|
||||
child: const Center(
|
||||
child: Text(
|
||||
textAlign: TextAlign.center,
|
||||
"Details der Station",
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stadtbote/content_views/tour_details_page.dart';
|
||||
import 'package:stadtbote/content_views/utils/content_view_widget.dart';
|
||||
import 'package:stadtbote/content_views/utils/header_info.dart';
|
||||
import 'package:stadtbote/messages/pop_content_view_message.dart';
|
||||
import 'package:stadtbote/model/job_tour.dart';
|
||||
import 'package:stadtbote/popups/map_popup.dart';
|
||||
import 'package:stadtbote/tools/message_service.dart';
|
||||
@@ -21,21 +21,10 @@ class TourListPage extends ContentViewWidget {
|
||||
State<TourListPage> createState() => _TourListPageState();
|
||||
|
||||
@override
|
||||
Future<HeaderInfo> getHeaderInfo(BuildContext context) async {
|
||||
return HeaderInfo(
|
||||
titleWidget: const Text(
|
||||
'Liste der Stationen',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
),
|
||||
rightButtonEnabled: true,
|
||||
rightButtonVisible: true,
|
||||
rightButtonImage: Util.fetchFutureIcon(const Icon(Icons.help_outline, size: 20.0, color: Colors.white)),
|
||||
rightButtonOnPressed: () async {
|
||||
await Util.startBrowser('https://app.assecutor.de/help/sb/app/context/004/index.html');
|
||||
});
|
||||
Future<Widget> getHeaderWidget(BuildContext context) async {
|
||||
await Future.delayed(const Duration(microseconds: 0));
|
||||
|
||||
return _HeaderWidget();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,3 +201,90 @@ class _TourListPageState extends State<TourListPage> {
|
||||
await MessageService().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: TourDetailsPage(job: widget.job, tour: tour, readOnly: readOnly));
|
||||
}
|
||||
}
|
||||
|
||||
class _HeaderWidget extends StatefulWidget {
|
||||
@override
|
||||
State<_HeaderWidget> createState() => _HeaderWidgetState();
|
||||
}
|
||||
|
||||
class _HeaderWidgetState extends State<_HeaderWidget> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var cellWidth = (MediaQuery.of(context).size.width - 60 - 60 - 25) / 2;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Visibility(
|
||||
visible: true,
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.white,
|
||||
),
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
await MessageService().publish<PopContentViewMessage>(Constants.messageTopicPopContentView, arguments: PopContentViewMessage(count: 1));
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
radius: 10,
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
child: Padding(padding: EdgeInsets.all(1.0), child: Icon(Icons.arrow_back, size: 20.0, color: Colors.white)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: false,
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.red,
|
||||
),
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
await MessageService().publish<PopContentViewMessage>(Constants.messageTopicPopContentView, arguments: PopContentViewMessage(count: 1));
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
radius: 10,
|
||||
child: Padding(padding: EdgeInsets.all(1.0), child: Icon(Icons.info_outline, size: 20.0, color: Colors.white))),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 100,
|
||||
width: cellWidth * 2,
|
||||
child: const Center(
|
||||
child: Text(
|
||||
textAlign: TextAlign.center,
|
||||
"Liste der Stationen",
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,9 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
import 'header_info.dart';
|
||||
|
||||
abstract class ContentViewWidget extends StatefulWidget {
|
||||
const ContentViewWidget({super.key});
|
||||
|
||||
Future<HeaderInfo> getHeaderInfo(BuildContext context);
|
||||
Future<Widget> getHeaderWidget(BuildContext context);
|
||||
|
||||
void close() {
|
||||
close();
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class HeaderInfo {
|
||||
late Widget titleWidget;
|
||||
late bool rightButtonEnabled;
|
||||
late bool rightButtonVisible;
|
||||
late Future<Widget?>? rightButtonImage;
|
||||
late Function rightButtonOnPressed;
|
||||
|
||||
HeaderInfo({required this.titleWidget, required this.rightButtonEnabled, required this.rightButtonVisible, this.rightButtonImage, required this.rightButtonOnPressed});
|
||||
}
|
||||
+23
-133
@@ -1,11 +1,9 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:shared_map/shared_map.dart';
|
||||
import 'package:stadtbote/messages/pop_content_view_message.dart';
|
||||
import 'package:stadtbote/model/enqueued_message.dart';
|
||||
@@ -22,6 +20,8 @@ import 'package:stadtbote/tools/connection_status.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/refresh_badges_message.dart';
|
||||
import 'package:stadtbote/tools/messages/remove_job_message.dart';
|
||||
import 'package:stadtbote/tools/mqtt_core.dart';
|
||||
|
||||
import 'content_views/main_page.dart';
|
||||
@@ -48,8 +48,6 @@ Future<void> main() async {
|
||||
PictureSchema
|
||||
], directory: dir.path, name: "database_v1");
|
||||
|
||||
var status = await Permission.storage.request();
|
||||
|
||||
await _clearLog();
|
||||
|
||||
runApp(const MyApp());
|
||||
@@ -169,15 +167,6 @@ class _MainState extends State<Main> with SingleTickerProviderStateMixin {
|
||||
|
||||
late Widget _currentTitleWidget;
|
||||
|
||||
late Widget _leftIconButton;
|
||||
late Widget _rightIconButton;
|
||||
|
||||
late bool _leftButtonVisible = false;
|
||||
late bool _rightButtonVisible = false;
|
||||
|
||||
late Function _rightButtonOnPressed;
|
||||
late Function _leftButtonOnPressed;
|
||||
|
||||
bool _initCompleted = false;
|
||||
|
||||
final ValueNotifier<bool> _connectionLostValueNotifier = ValueNotifier<bool>(true);
|
||||
@@ -207,22 +196,9 @@ class _MainState extends State<Main> with SingleTickerProviderStateMixin {
|
||||
|
||||
_startCheckForNewState0JobsJobsTimer();
|
||||
|
||||
_currentContent = MainPage();
|
||||
_currentContent = const MainPage();
|
||||
|
||||
var headerInfo = await _currentContent.getHeaderInfo(MyApp.appNavigatorKey.currentContext!);
|
||||
_currentTitleWidget = headerInfo.titleWidget;
|
||||
|
||||
_leftButtonVisible = false;
|
||||
_leftIconButton = const Icon(Icons.arrow_back, size: 20.0, color: Colors.white);
|
||||
_leftButtonOnPressed = () {
|
||||
_popContentView(1);
|
||||
};
|
||||
|
||||
_rightButtonVisible = headerInfo.rightButtonVisible;
|
||||
_rightButtonOnPressed = headerInfo.rightButtonOnPressed;
|
||||
if (headerInfo.rightButtonEnabled) {
|
||||
_rightIconButton = await headerInfo.rightButtonImage as Widget;
|
||||
}
|
||||
_currentTitleWidget = await _currentContent.getHeaderWidget(MyApp.appNavigatorKey.currentContext!);
|
||||
|
||||
_initCompleted = true;
|
||||
|
||||
@@ -256,66 +232,11 @@ class _MainState extends State<Main> with SingleTickerProviderStateMixin {
|
||||
child: SizedBox(
|
||||
height: 100,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
padding: const EdgeInsets.all(0),
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Visibility(
|
||||
visible: _leftButtonVisible,
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.white,
|
||||
),
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
_leftButtonOnPressed();
|
||||
},
|
||||
child: CircleAvatar(
|
||||
radius: 15,
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
child: Padding(padding: const EdgeInsets.all(1.0), child: _leftIconButton),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: _rightButtonVisible,
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.red,
|
||||
),
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
_rightButtonOnPressed();
|
||||
},
|
||||
child: CircleAvatar(
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
radius: 15,
|
||||
child: Padding(padding: const EdgeInsets.all(1.0), child: _rightIconButton),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 100,
|
||||
width: 300,
|
||||
child: Center(heightFactor: 1, child: _currentTitleWidget),
|
||||
),
|
||||
Center(heightFactor: 1, child: _currentTitleWidget),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -361,29 +282,34 @@ class _MainState extends State<Main> with SingleTickerProviderStateMixin {
|
||||
}
|
||||
|
||||
void _initMessages() {
|
||||
MessageService().unsubscribe(Constants.messageTopicPushContentView, this);
|
||||
MessageService().unsubscribe(Constants.messageTopicPopContentView, this);
|
||||
MessageService().unsubscribe(Constants.messageTopicReplaceContentView, this);
|
||||
MessageService().unsubscribe(Constants.messageTopicHideRightButton, this);
|
||||
MessageService().unsubscribe(Constants.messageTopicConnectionStatusChanged, this);
|
||||
MessageService().unsubscribe(Constants.messageTopicJobReceived, this);
|
||||
MessageService().unsubscribeAll(this);
|
||||
|
||||
MessageService().subscribe<ContentViewWidget>(Constants.messageTopicPushContentView, this, (ContentViewWidget widget) {
|
||||
_pushContentView(widget);
|
||||
});
|
||||
|
||||
MessageService().subscribe<PopContentViewMessage>(Constants.messageTopicPopContentView, this, (PopContentViewMessage message) {
|
||||
_popContentView(message.count);
|
||||
});
|
||||
|
||||
MessageService().subscribe<ContentViewWidget>(Constants.messageTopicReplaceContentView, this, (ContentViewWidget widget) {
|
||||
_replaceContentView(widget);
|
||||
});
|
||||
MessageService().subscribe<bool>(Constants.messageTopicHideRightButton, this, (hideButton) {
|
||||
_hideRightButton(hideButton);
|
||||
});
|
||||
|
||||
MessageService().subscribe<ConnectionStatus>(Constants.messageTopicConnectionStatusChanged, this, (ConnectionStatus connectionStatus) {
|
||||
_connectionStatusChanged(connectionStatus);
|
||||
});
|
||||
|
||||
MessageService().subscribe<RemoveJobMessage>(Constants.messageTopicRemoveJob, this, (RemoveJobMessage job) async {
|
||||
await MyApp.isarInstance.writeTxn(() async {
|
||||
await MyApp.isarInstance.jobs.where().filter().idEqualTo(job.id).deleteAll();
|
||||
});
|
||||
|
||||
await MessageService().publish<JobDeletedMessage>(Constants.messageTopicJobDeleted, arguments: JobDeletedMessage(id: job.id));
|
||||
|
||||
await MessageService().publish<RefreshBadgesMessage>(Constants.messageTopicUpdateBadges, arguments: RefreshBadgesMessage());
|
||||
});
|
||||
|
||||
MessageService().subscribe<JobReceivedMessage>(Constants.messageTopicJobReceived, this, (JobReceivedMessage jobReceivedMessage) async {
|
||||
if (jobReceivedMessage.job.state == 0) {
|
||||
await _jobMap!.put(jobReceivedMessage.job.id, jobReceivedMessage.job);
|
||||
@@ -403,16 +329,7 @@ class _MainState extends State<Main> with SingleTickerProviderStateMixin {
|
||||
_currentContent = widget;
|
||||
});
|
||||
|
||||
var headerInfo = await _currentContent.getHeaderInfo(context);
|
||||
_currentTitleWidget = headerInfo.titleWidget;
|
||||
_rightButtonVisible = headerInfo.rightButtonVisible;
|
||||
_rightButtonOnPressed = headerInfo.rightButtonOnPressed;
|
||||
|
||||
if (headerInfo.rightButtonEnabled) {
|
||||
_rightIconButton = await headerInfo.rightButtonImage as Widget;
|
||||
}
|
||||
|
||||
_leftButtonVisible = false;
|
||||
_currentTitleWidget = await _currentContent.getHeaderWidget(context);
|
||||
|
||||
setState(() {});
|
||||
});
|
||||
@@ -428,18 +345,7 @@ class _MainState extends State<Main> with SingleTickerProviderStateMixin {
|
||||
|
||||
_currentContent = previousContentView;
|
||||
|
||||
var headerInfo = await _currentContent.getHeaderInfo(context);
|
||||
_currentTitleWidget = headerInfo.titleWidget;
|
||||
_rightButtonVisible = headerInfo.rightButtonVisible;
|
||||
_rightButtonOnPressed = headerInfo.rightButtonOnPressed;
|
||||
|
||||
if (headerInfo.rightButtonEnabled) {
|
||||
_rightIconButton = await headerInfo.rightButtonImage as Widget;
|
||||
}
|
||||
|
||||
if (contentStack.isEmpty) {
|
||||
_leftButtonVisible = false;
|
||||
}
|
||||
_currentTitleWidget = await _currentContent.getHeaderWidget(context);
|
||||
|
||||
setState(() {});
|
||||
});
|
||||
@@ -451,28 +357,12 @@ class _MainState extends State<Main> with SingleTickerProviderStateMixin {
|
||||
|
||||
_currentContent = widget;
|
||||
|
||||
var headerInfo = await _currentContent.getHeaderInfo(context);
|
||||
|
||||
_currentTitleWidget = headerInfo.titleWidget;
|
||||
_rightButtonVisible = headerInfo.rightButtonVisible;
|
||||
_rightButtonOnPressed = headerInfo.rightButtonOnPressed;
|
||||
|
||||
if (headerInfo.rightButtonEnabled) {
|
||||
_rightIconButton = await headerInfo.rightButtonImage as Widget;
|
||||
}
|
||||
|
||||
_leftButtonVisible = true;
|
||||
_currentTitleWidget = await _currentContent.getHeaderWidget(context);
|
||||
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
|
||||
void _hideRightButton(bool hideButton) {
|
||||
setState(() {
|
||||
_rightButtonVisible = !hideButton;
|
||||
});
|
||||
}
|
||||
|
||||
void _connectionStatusChanged(ConnectionStatus newConnectionStatus) {
|
||||
var currentConnectionStatus = newConnectionStatus.status;
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import 'package:stadtbote/protocoll_messages/fin_task_message.dart';
|
||||
import 'package:stadtbote/tools/constants.dart';
|
||||
import 'package:stadtbote/tools/message_service.dart';
|
||||
import 'package:stadtbote/tools/messages/refresh_badges_message.dart';
|
||||
import 'package:stadtbote/tools/messages/remove_job_message.dart';
|
||||
import 'package:stadtbote/tools/util.dart';
|
||||
import 'package:badges/badges.dart' as badges;
|
||||
|
||||
@@ -230,6 +231,10 @@ Future<List<Widget>> _fetchJobWidgets(StateSetter dialogState, Function() onFini
|
||||
|
||||
jobMap.remove(job.id);
|
||||
|
||||
MessageService().publish<RemoveJobMessage>(Constants.messageTopicRemoveJob, arguments: RemoveJobMessage(id: job.id));
|
||||
|
||||
setState(() {});
|
||||
|
||||
if (jobMap.length() == 0) {
|
||||
Navigator.of(context).pop();
|
||||
|
||||
@@ -250,6 +255,10 @@ Future<List<Widget>> _fetchJobWidgets(StateSetter dialogState, Function() onFini
|
||||
|
||||
jobMap.remove(job.id);
|
||||
|
||||
MessageService().publish<RemoveJobMessage>(Constants.messageTopicRemoveJob, arguments: RemoveJobMessage(id: job.id));
|
||||
|
||||
setState(() {});
|
||||
|
||||
if (jobMap.length() == 0) {
|
||||
Navigator.of(context).pop();
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ showReceiptGiverPopup(BuildContext context, TaskInfo taskInfo, Function(String)
|
||||
textInputType: TextInputType.text,
|
||||
formatter: [FilteringTextInputFormatter.singleLineFormatter],
|
||||
controller: textEditingController,
|
||||
maxLength: 50,
|
||||
maxLength: 40,
|
||||
autofocus: true),
|
||||
const SizedBox(height: 20),
|
||||
getDefaultButton('Übernehmen', () {
|
||||
|
||||
@@ -12,12 +12,12 @@ class Constants {
|
||||
static const String messageTopicRankingUpdated = "ranking_updated";
|
||||
static const String messageTopicJobReceived = "job_received";
|
||||
static const String messageTopicJobDeleted = "job_deleted";
|
||||
static const String messageTopicRemoveJob = "remove_job";
|
||||
static const String messageTopicUpdateBadges = "update_badges";
|
||||
static const String messageTopicMessageReceived = "message_received";
|
||||
static const String messageTopicPushContentView = "push_content_view";
|
||||
static const String messageTopicPopContentView = "pop_content_view";
|
||||
static const String messageTopicReplaceContentView = "replace_content_view";
|
||||
static const String messageTopicHideRightButton = "hide_right_button";
|
||||
static const String messageTopicPublishPayload = "publish_payload_message";
|
||||
static const String messageTopicConnectClient = "connect_client";
|
||||
static const String messageTopicDisconnectClient = "disconnect_client";
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
class RemoveJobMessage {
|
||||
final int id;
|
||||
|
||||
RemoveJobMessage({required this.id});
|
||||
}
|
||||
@@ -332,14 +332,11 @@ class MqttCore {
|
||||
void _jobDeleteReceived(payloadData) async {
|
||||
var jobDelMessage = JobDelMessage.fromJson(payloadData);
|
||||
|
||||
var foundJobs = await MyApp.isarInstance.jobs.where().filter().idEqualTo(jobDelMessage.id).findAll();
|
||||
if (foundJobs.isNotEmpty) {
|
||||
await MyApp.isarInstance.writeTxn(() async {
|
||||
await MyApp.isarInstance.jobs.delete(jobDelMessage.id);
|
||||
});
|
||||
await MyApp.isarInstance.writeTxn(() async {
|
||||
await MyApp.isarInstance.jobs.where().filter().idEqualTo(jobDelMessage.id).deleteAll();
|
||||
});
|
||||
|
||||
await MessageService().publish<JobDeletedMessage>(Constants.messageTopicJobDeleted, arguments: JobDeletedMessage(id: jobDelMessage.id));
|
||||
}
|
||||
await MessageService().publish<JobDeletedMessage>(Constants.messageTopicJobDeleted, arguments: JobDeletedMessage(id: jobDelMessage.id));
|
||||
}
|
||||
|
||||
void _syncRequestReceived(payloadData) async {
|
||||
|
||||
+1
-1
@@ -374,7 +374,7 @@ String mapTourMode(String mode) {
|
||||
text += "/ Auslieferung";
|
||||
break;
|
||||
|
||||
case "pudel":
|
||||
case "pu/del":
|
||||
text += "/ Abholung/Auslieferung";
|
||||
break;
|
||||
}
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 321.0.0+321
|
||||
version: 322.0.0+322
|
||||
|
||||
environment:
|
||||
sdk: '>=2.19.6 <3.0.0'
|
||||
|
||||
Reference in new issue
Block a user