Erweiterungen
This commit is contained in:
1 parent
dbe821b08d
commit
ebe61c1674
7 files changed
+299
-303
No files matched your search
@@ -1,134 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:isar/isar.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/popups/accept_job_popup.dart';
|
||||
|
||||
import '../main.dart';
|
||||
import '../model/job.dart';
|
||||
import '../tools/util.dart';
|
||||
|
||||
class AssignedJobsPage extends ContentViewWidget {
|
||||
const AssignedJobsPage({super.key});
|
||||
|
||||
@override
|
||||
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: 24.0,
|
||||
),
|
||||
),
|
||||
rightButtonEnabled: false,
|
||||
rightButtonVisible: false,
|
||||
rightButtonImage: null,
|
||||
rightButtonOnPressed: () async {
|
||||
//BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: EmployeeEditProfileWidget());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class _AssignedJobsPageState extends State<AssignedJobsPage> {
|
||||
late List<Job> _jobs;
|
||||
|
||||
late bool _initCompleted = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
Future.delayed(const Duration(seconds: 0), () async {
|
||||
_jobs = await MyApp.isarInstance.jobs.filter().stateEqualTo(0).findAll();
|
||||
|
||||
_initCompleted = true;
|
||||
|
||||
setState(() {});
|
||||
});
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (!_initCompleted) {
|
||||
return Util.getWaitWidget(context);
|
||||
}
|
||||
|
||||
late List<Widget> jobWidgets = _createjobWidgets();
|
||||
|
||||
return ListView(
|
||||
children: jobWidgets
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> _createjobWidgets() {
|
||||
List<Widget> jobWidgets = [];
|
||||
|
||||
for (var job in _jobs) {
|
||||
jobWidgets.add(
|
||||
ListTile(
|
||||
onTap: () {
|
||||
_clicked(job);
|
||||
},
|
||||
title: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
border: Border.all(color: Colors.grey, width: 0.5),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(13))
|
||||
),
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
DateFormat('dd.MM.yyyy HH:mm').format(DateTime.parse(job.ordertime)).toString(),
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
Text(
|
||||
job.crFilter != null ? job.crFilter.toString() : "Kein CR-Filter vorhanden",
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.arrow_back, size: 30.0, color: Colors.black),
|
||||
const SizedBox(width: 10),
|
||||
Text(
|
||||
job.vhtId.toString()
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
job.id.toString(),
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
Text(
|
||||
job.tours[0].comp,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
Text(
|
||||
job.tours[0].street,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
Text(
|
||||
job.tours[0].city,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return jobWidgets;
|
||||
}
|
||||
|
||||
void _clicked(Job job) {
|
||||
showAcceptJobPopup(context, job);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,14 @@
|
||||
|
||||
import 'package:flutter/material.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/accept_job_popup.dart';
|
||||
import 'package:stadtbote/popups/accept_jobs_popup.dart';
|
||||
import 'package:stadtbote/popups/infos_popup.dart';
|
||||
import 'package:stadtbote/tools/messages/job_received_message.dart';
|
||||
import 'package:stadtbote/tools/messages/session_info_update.dart';
|
||||
@@ -88,7 +86,7 @@ class _MainPageState extends State<MainPage> {
|
||||
super.initState();
|
||||
|
||||
_refreshBadges();
|
||||
|
||||
|
||||
_initMessages();
|
||||
}
|
||||
|
||||
@@ -105,34 +103,6 @@ class _MainPageState extends State<MainPage> {
|
||||
children: [
|
||||
ValueListenableBuilder<int>(
|
||||
valueListenable: _assignedJobsValueNotifier,
|
||||
builder: (context, value, child) {
|
||||
return badges.Badge(
|
||||
showBadge: value > 0,
|
||||
position: badges.BadgePosition.topEnd(top: -12, 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: 20),
|
||||
ValueListenableBuilder<int>(
|
||||
valueListenable: _acceptedJobsValueNotifier,
|
||||
builder: (context, value, child) {
|
||||
return badges.Badge(
|
||||
showBadge: value > 0,
|
||||
@@ -152,13 +122,43 @@ class _MainPageState extends State<MainPage> {
|
||||
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 AcceptedJobsPage())})
|
||||
'Zugewiesene Aufträge',
|
||||
image: Image.asset('assets/zugewiesene_auftraege.png', width: 30, height: 30),
|
||||
() => {showAcceptJobsPopup(context)}),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
ValueListenableBuilder<int>(
|
||||
valueListenable: _acceptedJobsValueNotifier,
|
||||
builder: (context, value, child) {
|
||||
return badges.Badge(
|
||||
showBadge: value > 0,
|
||||
position: badges.BadgePosition.topEnd(top: -12, 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 AcceptedJobsPage())
|
||||
}));
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
getDefaultButton(
|
||||
'Erledigte Aufträge',
|
||||
image: Image.asset('assets/erledigte_auftraege.png', width: 30, height: 30),
|
||||
@@ -187,8 +187,9 @@ class _MainPageState extends State<MainPage> {
|
||||
child: getDefaultButton(
|
||||
'Nachrichten',
|
||||
image: Image.asset('assets/nachrichten.png', width: 30, height: 30),
|
||||
() => {BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const MessagesPage())})
|
||||
);
|
||||
() => {
|
||||
BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const MessagesPage())
|
||||
}));
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
@@ -266,6 +267,6 @@ class _MainPageState extends State<MainPage> {
|
||||
}
|
||||
|
||||
void _showAcceptanceDialog(Job job) {
|
||||
showAcceptJobPopup(context, job);
|
||||
showAcceptJobsPopup(context);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user