Erweiterungen
This commit is contained in:
1 parent
cb4525a774
commit
5c3cee2d92
10 files changed
+466
-54
No files matched your search
@@ -1,6 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_broadcast_receiver/flutter_broadcast_receiver.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 '../main.dart';
|
||||
import '../model/job.dart';
|
||||
import '../tools/constants.dart';
|
||||
import '../tools/util.dart';
|
||||
|
||||
class AssignedJobsPage extends ContentViewWidget {
|
||||
const AssignedJobsPage({super.key});
|
||||
@@ -12,7 +21,7 @@ class AssignedJobsPage extends ContentViewWidget {
|
||||
Future<HeaderInfo> getHeaderInfo(BuildContext context) async {
|
||||
return HeaderInfo(
|
||||
titleWidget: const Text(
|
||||
'Startseite',
|
||||
'Zugewiesene Aufträge',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 24.0,
|
||||
@@ -28,42 +37,99 @@ class AssignedJobsPage extends ContentViewWidget {
|
||||
}
|
||||
|
||||
class _AssignedJobsPageState extends State<AssignedJobsPage> {
|
||||
void sendMessage(Widget message) {
|
||||
//Messaging.instance.sendMessage(message);
|
||||
}
|
||||
late List<Job> _jobs;
|
||||
|
||||
void _clicked() {
|
||||
//sendMessage(const InfoDetailsWidget());
|
||||
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: <Widget>[
|
||||
ListTile(
|
||||
title: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: const <Widget>[
|
||||
Text(
|
||||
'Dies ist ein linksbündigerText',
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
Text(
|
||||
'Dies ist ein linksbündiger Text',
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
color: Colors.blue,
|
||||
fontSize: 24.0,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
onTap: () {
|
||||
_clicked();
|
||||
},
|
||||
),
|
||||
],
|
||||
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) {
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:kumi_popup_window/kumi_popup_window.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_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/scan_barcodes_popup.dart';
|
||||
|
||||
import '../main.dart';
|
||||
import '../model/task_info.dart';
|
||||
@@ -40,6 +44,8 @@ class _TaskListPageState extends State<TaskListPage> {
|
||||
|
||||
late List<TaskInfo> _taskList;
|
||||
|
||||
late KumiPopupWindow _popup;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
Future.delayed(const Duration(seconds: 0), () async {
|
||||
@@ -118,6 +124,7 @@ class _TaskListPageState extends State<TaskListPage> {
|
||||
const SizedBox(width: 20),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
taskInfo.task.topic,
|
||||
@@ -127,8 +134,9 @@ class _TaskListPageState extends State<TaskListPage> {
|
||||
fontSize: 15.0,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
taskInfo.additionalText ?? '',
|
||||
taskInfo.additionalText ?? 'Additonal text',
|
||||
textAlign: TextAlign.left,
|
||||
style: const TextStyle(
|
||||
color: Colors.blue,
|
||||
@@ -141,7 +149,7 @@ class _TaskListPageState extends State<TaskListPage> {
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
print('1');
|
||||
_processTask(taskInfo);
|
||||
},
|
||||
),
|
||||
);
|
||||
@@ -166,4 +174,38 @@ class _TaskListPageState extends State<TaskListPage> {
|
||||
|
||||
return taskList;
|
||||
}
|
||||
|
||||
void _processTask(TaskInfo taskInfo) {
|
||||
switch(taskInfo.task.type) {
|
||||
case 3:
|
||||
_processTaskArrived(taskInfo);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
_processScanBarcodes(taskInfo);
|
||||
break;
|
||||
|
||||
case 9:
|
||||
_processCommissionNumber(taskInfo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void _processTaskArrived(TaskInfo taskInfo) {
|
||||
_popup = showTaskArrivedPopup(context, taskInfo, () => {
|
||||
_popup.dismiss(context),
|
||||
});
|
||||
}
|
||||
|
||||
void _processCommissionNumber(TaskInfo taskInfo) {
|
||||
_popup = showCommisionNumberPopup(context, taskInfo, () => {
|
||||
_popup.dismiss(context),
|
||||
});
|
||||
}
|
||||
|
||||
void _processScanBarcodes(TaskInfo taskInfo) {
|
||||
_popup = showScanBarcodesPopup(context, taskInfo, () => {
|
||||
_popup.dismiss(context)
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user