1. Import
This commit is contained in:
commit
cb4525a774
165 files changed
+14763
No files matched your search
@@ -0,0 +1,136 @@
|
||||
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 AcceptedJobsPage extends ContentViewWidget {
|
||||
const AcceptedJobsPage({super.key});
|
||||
|
||||
@override
|
||||
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: 24.0,
|
||||
),
|
||||
),
|
||||
rightButtonEnabled: false,
|
||||
rightButtonVisible: false,
|
||||
rightButtonImage: null,
|
||||
rightButtonOnPressed: () async {
|
||||
//BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: EmployeeEditProfileWidget());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class _AcceptedJobsPageState extends State<AcceptedJobsPage> {
|
||||
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(1).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) {
|
||||
BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: TourListPage(job: job));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stadtbote/content_views/utils/content_view_widget.dart';
|
||||
import 'package:stadtbote/content_views/utils/header_info.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(
|
||||
'Startseite',
|
||||
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> {
|
||||
void sendMessage(Widget message) {
|
||||
//Messaging.instance.sendMessage(message);
|
||||
}
|
||||
|
||||
void _clicked() {
|
||||
//sendMessage(const InfoDetailsWidget());
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
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();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stadtbote/content_views/utils/content_view_widget.dart';
|
||||
import 'package:stadtbote/content_views/utils/header_info.dart';
|
||||
|
||||
class FinishedJobsPage extends ContentViewWidget {
|
||||
const FinishedJobsPage({super.key});
|
||||
|
||||
@override
|
||||
State<FinishedJobsPage> createState() => _FinishedJobsPageState();
|
||||
|
||||
@override
|
||||
Future<HeaderInfo> getHeaderInfo(BuildContext context) async {
|
||||
return HeaderInfo(
|
||||
titleWidget: const Text(
|
||||
'Startseite',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 24.0,
|
||||
),
|
||||
),
|
||||
rightButtonEnabled: false,
|
||||
rightButtonVisible: false,
|
||||
rightButtonImage: null,
|
||||
rightButtonOnPressed: () async {
|
||||
//BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: EmployeeEditProfileWidget());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class _FinishedJobsPageState extends State<FinishedJobsPage> {
|
||||
void sendMessage(Widget message) {
|
||||
//Messaging.instance.sendMessage(message);
|
||||
}
|
||||
|
||||
void _clicked() {
|
||||
//sendMessage(const InfoDetailsWidget());
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
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();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_broadcast_receiver/flutter_broadcast_receiver.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/utils/content_view_widget.dart';
|
||||
import 'package:stadtbote/content_views/utils/header_info.dart';
|
||||
import 'package:stadtbote/popups/infos_popup.dart';
|
||||
|
||||
import '../main.dart';
|
||||
import '../model/job.dart';
|
||||
import '../tools/constants.dart';
|
||||
import '../tools/util.dart';
|
||||
|
||||
class MainPage extends ContentViewWidget {
|
||||
const MainPage({super.key});
|
||||
|
||||
@override
|
||||
State<MainPage> createState() => _MainPageState();
|
||||
|
||||
@override
|
||||
Future<HeaderInfo> getHeaderInfo(BuildContext context) async {
|
||||
return HeaderInfo(
|
||||
titleWidget: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 3),
|
||||
child: Column(children: const [
|
||||
Text(
|
||||
'Zeile 1',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18.0,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
Text(
|
||||
'Zeile 2',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18.0,
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
rightButtonEnabled: true,
|
||||
rightButtonVisible: true,
|
||||
rightButtonImage: Util.fetchFutureIcon(const Icon(Icons.info_outline, size: 20.0, color: Colors.white)),
|
||||
rightButtonOnPressed: () async {
|
||||
showInfosPopup(context);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class _MainPageState extends State<MainPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
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())}),
|
||||
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())}),
|
||||
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 FinishedJobsPage())
|
||||
}),
|
||||
const SizedBox(height: 10),
|
||||
getDefaultButton(
|
||||
'Anfahrtsbereich',
|
||||
image: Image.asset('assets/anfahrtsbereich.png', width: 30, height: 30),
|
||||
() => {
|
||||
//BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const FinishedJobsPage())
|
||||
}),
|
||||
const SizedBox(height: 10),
|
||||
getDefaultButton(
|
||||
'Abmelden',
|
||||
image: Image.asset('assets/abmelden.png', width: 30, height: 30),
|
||||
() => {
|
||||
_test()
|
||||
//BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const FinishedJobsPage())
|
||||
}),
|
||||
Expanded(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.transparent,
|
||||
border: Border.all(
|
||||
color: Colors.transparent,
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Image.asset(
|
||||
'assets/sb_logo.png',
|
||||
width: 100,
|
||||
height: 100,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
void _test() async {
|
||||
var json = await rootBundle.loadString('assets/job.json');
|
||||
var jsonMap = jsonDecode(json);
|
||||
var payload = jsonMap["payload"];
|
||||
|
||||
var jobsPayload = JobsPayload.fromJson(payload);
|
||||
|
||||
if (jobsPayload.jobs != null) {
|
||||
MyApp.isarInstance.writeTxnSync(() {
|
||||
for (var job in jobsPayload.jobs as List<Job>) {
|
||||
MyApp.isarInstance.jobs.putSync(job);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
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:stadtbote/model/job_tour.dart';
|
||||
|
||||
import '../main.dart';
|
||||
import '../model/task_info.dart';
|
||||
import '../tools/util.dart';
|
||||
|
||||
class TaskListPage extends ContentViewWidget {
|
||||
const TaskListPage({super.key, required this.tour});
|
||||
|
||||
final JobTour tour;
|
||||
|
||||
@override
|
||||
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: 24.0,
|
||||
),
|
||||
),
|
||||
rightButtonEnabled: false,
|
||||
rightButtonVisible: false,
|
||||
rightButtonImage: null,
|
||||
rightButtonOnPressed: () async {
|
||||
//BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: EmployeeEditProfileWidget());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class _TaskListPageState extends State<TaskListPage> {
|
||||
late bool _initCompleted = false;
|
||||
|
||||
late List<TaskInfo> _taskList;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
Future.delayed(const Duration(seconds: 0), () async {
|
||||
_taskList = await _fetchTaskList();
|
||||
|
||||
_initCompleted = true;
|
||||
|
||||
setState(() {});
|
||||
});
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (!_initCompleted) {
|
||||
return Util.getWaitWidget(context);
|
||||
}
|
||||
|
||||
var steps = _initSteps();
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
padding: const EdgeInsets.all(0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: steps,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> _initSteps() {
|
||||
List<Widget> steps = [];
|
||||
for (int i=0; i<_taskList.length; i++) {
|
||||
var taskInfo = _taskList[i];
|
||||
|
||||
steps.add(
|
||||
ListTile(
|
||||
minVerticalPadding: 0,
|
||||
title: Container(
|
||||
padding: const EdgeInsets.all(0),
|
||||
height: 60,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: <Widget>[
|
||||
Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
left: 16.5,
|
||||
top: i == 0 ? 5 : 0,
|
||||
child: Container(
|
||||
height: i == widget.tour.tasks.length - 1 ? 1: 60,
|
||||
width: 6,
|
||||
color: Colors.green
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.grey,
|
||||
),
|
||||
child: const Icon(Icons.check, size: 30.0, color: Colors.white),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
taskInfo.task.topic,
|
||||
textAlign: TextAlign.left,
|
||||
style: const TextStyle(
|
||||
color: Colors.blue,
|
||||
fontSize: 15.0,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
taskInfo.additionalText ?? '',
|
||||
textAlign: TextAlign.left,
|
||||
style: const TextStyle(
|
||||
color: Colors.blue,
|
||||
fontSize: 12.0,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
print('1');
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return steps;
|
||||
}
|
||||
|
||||
Future<List<TaskInfo>> _fetchTaskList() async {
|
||||
List<TaskInfo> taskList = [];
|
||||
|
||||
for(var task in widget.tour.tasks) {
|
||||
var taskInfo = await MyApp.isarInstance.taskInfos.filter().sIdEqualTo(task.sId).findFirst();
|
||||
taskInfo ??= TaskInfo();
|
||||
taskInfo.task = task;
|
||||
|
||||
taskInfo.answer = null;
|
||||
taskInfo.additionalText = null;
|
||||
|
||||
taskList.add(taskInfo);
|
||||
}
|
||||
|
||||
return taskList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_broadcast_receiver/flutter_broadcast_receiver.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/model/job_tour.dart';
|
||||
|
||||
import '../model/job.dart';
|
||||
import '../popups/map_popup.dart';
|
||||
import '../tools/constants.dart';
|
||||
import '../tools/util.dart';
|
||||
|
||||
class TourDetailsPage extends ContentViewWidget {
|
||||
const TourDetailsPage({super.key, required this.job, required this.tour});
|
||||
|
||||
final Job job;
|
||||
final JobTour tour;
|
||||
|
||||
@override
|
||||
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: 24.0,
|
||||
),
|
||||
),
|
||||
rightButtonEnabled: false,
|
||||
rightButtonVisible: false,
|
||||
rightButtonImage: null,
|
||||
rightButtonOnPressed: () async {
|
||||
//BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: EmployeeEditProfileWidget());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class _TourDetailsPageState extends State<TourDetailsPage> {
|
||||
late bool _initCompleted = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
Future.delayed(const Duration(seconds: 0), () async {
|
||||
_initCompleted = true;
|
||||
|
||||
setState(() {});
|
||||
});
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (!_initCompleted) {
|
||||
return Util.getWaitWidget(context);
|
||||
}
|
||||
|
||||
var remark = "";
|
||||
if (widget.tour.rem.isNotEmpty) {
|
||||
for (var remRow in widget.tour.rem) {
|
||||
remark += "$remRow\n";
|
||||
}
|
||||
} else {
|
||||
remark = "* Keine Bemerkung vorhanden *";
|
||||
}
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey, width: 0.5),
|
||||
color: Colors.transparent,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(13))
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
"${"Station ${widget.tour.sort}"} ${mapTourMode(widget.tour.mode)}",
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
Text(
|
||||
widget.tour.comp,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
Text(
|
||||
widget.tour.person,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
Text(
|
||||
widget.tour.street,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
Text(
|
||||
widget.tour.city,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
Text(
|
||||
"Tel.: ${widget.tour.phone}",
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
Text(
|
||||
"Komm-#: ${widget.tour.com}",
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
getDefaultButton('Karte', () =>
|
||||
{
|
||||
showMapPopup(context, widget.tour, widget.job.tours)
|
||||
}),
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey, width: 0.5),
|
||||
color: Colors.transparent,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(13))
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(remark),
|
||||
]
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
getDefaultButton('Weiter', () =>
|
||||
{
|
||||
BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: TaskListPage(tour: widget.tour))
|
||||
}),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_broadcast_receiver/flutter_broadcast_receiver.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/model/job_tour.dart';
|
||||
|
||||
import '../model/job.dart';
|
||||
import '../tools/constants.dart';
|
||||
import '../tools/util.dart';
|
||||
|
||||
class TourListPage extends ContentViewWidget {
|
||||
const TourListPage({super.key, required this.job});
|
||||
|
||||
final Job job;
|
||||
|
||||
@override
|
||||
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: 24.0,
|
||||
),
|
||||
),
|
||||
rightButtonEnabled: false,
|
||||
rightButtonVisible: false,
|
||||
rightButtonImage: null,
|
||||
rightButtonOnPressed: () async {
|
||||
//BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: EmployeeEditProfileWidget());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class _TourListPageState extends State<TourListPage> {
|
||||
late List<JobTour> _tours;
|
||||
|
||||
late bool _initCompleted = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
Future.delayed(const Duration(seconds: 0), () async {
|
||||
_tours = widget.job.tours;
|
||||
|
||||
_initCompleted = true;
|
||||
|
||||
setState(() {});
|
||||
});
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (!_initCompleted) {
|
||||
return Util.getWaitWidget(context);
|
||||
}
|
||||
|
||||
late List<Widget> jobWidgets = _createjobWidgets();
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
color: Colors.transparent,
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
widget.job.id.toString(),
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
widget.job.crFilter != null ? widget.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(
|
||||
widget.job.vhtId.toString()
|
||||
),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.all(0),
|
||||
children: jobWidgets
|
||||
),
|
||||
)
|
||||
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> _createjobWidgets() {
|
||||
List<Widget> jobWidgets = [];
|
||||
|
||||
for (var tour in _tours) {
|
||||
Color color = Colors.transparent;
|
||||
switch(tour.state) {
|
||||
case 1:
|
||||
color = Colors.lightGreen;
|
||||
break;
|
||||
|
||||
default:
|
||||
color = Colors.yellow;
|
||||
break;
|
||||
}
|
||||
|
||||
jobWidgets.add(
|
||||
ListTile(
|
||||
contentPadding: const EdgeInsets.all(0),
|
||||
onTap: () {
|
||||
_clicked(tour);
|
||||
},
|
||||
title: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey, width: 0.5),
|
||||
color: color,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(13))
|
||||
),
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
"${"Station ${tour.sort}"} ${mapTourMode(tour.mode)}",
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
Text(
|
||||
tour.comp,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
Text(
|
||||
tour.street,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
Text(
|
||||
tour.city,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return jobWidgets;
|
||||
}
|
||||
|
||||
void _clicked(JobTour tour) {
|
||||
BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: TourDetailsPage(job: widget.job, tour: tour));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
import 'header_info.dart';
|
||||
|
||||
abstract class ContentViewWidget extends StatefulWidget {
|
||||
const ContentViewWidget({super.key});
|
||||
|
||||
Future<HeaderInfo> getHeaderInfo(BuildContext context);
|
||||
|
||||
void close() {
|
||||
close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
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});
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
class WidgetStack<E> {
|
||||
final _list = <E>[];
|
||||
|
||||
void push(E value) => _list.add(value);
|
||||
|
||||
E pop() => _list.removeLast();
|
||||
|
||||
E get peek => _list.last;
|
||||
|
||||
bool get isEmpty => _list.isEmpty;
|
||||
bool get isNotEmpty => _list.isNotEmpty;
|
||||
|
||||
void clear() => _list.clear();
|
||||
|
||||
@override
|
||||
String toString() => _list.toString();
|
||||
}
|
||||
Reference in new issue
Block a user