Erweiterungen
This commit is contained in:
1 parent
70a8c04516
commit
b7d45efecc
5 files changed
+99
-22
No files matched your search
@@ -1,6 +1,15 @@
|
|||||||
import 'package:flutter/material.dart';
|
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/content_view_widget.dart';
|
||||||
import 'package:stadtbote/content_views/utils/header_info.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 FinishedJobsPage extends ContentViewWidget {
|
class FinishedJobsPage extends ContentViewWidget {
|
||||||
const FinishedJobsPage({super.key});
|
const FinishedJobsPage({super.key});
|
||||||
@@ -12,7 +21,7 @@ class FinishedJobsPage extends ContentViewWidget {
|
|||||||
Future<HeaderInfo> getHeaderInfo(BuildContext context) async {
|
Future<HeaderInfo> getHeaderInfo(BuildContext context) async {
|
||||||
return HeaderInfo(
|
return HeaderInfo(
|
||||||
titleWidget: const Text(
|
titleWidget: const Text(
|
||||||
'Startseite',
|
'Erledigte Aufträge',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 24.0,
|
fontSize: 24.0,
|
||||||
@@ -28,42 +37,100 @@ class FinishedJobsPage extends ContentViewWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _FinishedJobsPageState extends State<FinishedJobsPage> {
|
class _FinishedJobsPageState extends State<FinishedJobsPage> {
|
||||||
void sendMessage(Widget message) {
|
late List<Job> _jobs;
|
||||||
//Messaging.instance.sendMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _clicked() {
|
late bool _initCompleted = false;
|
||||||
//sendMessage(const InfoDetailsWidget());
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
Future.delayed(const Duration(seconds: 0), () async {
|
||||||
|
_jobs = await MyApp.isarInstance.jobs.filter().stateEqualTo(2).findAll();
|
||||||
|
|
||||||
|
_initCompleted = true;
|
||||||
|
|
||||||
|
setState(() {});
|
||||||
|
});
|
||||||
|
|
||||||
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
if (!_initCompleted) {
|
||||||
|
return Util.getWaitWidget(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
late List<Widget> jobWidgets = _createjobWidgets();
|
||||||
|
|
||||||
return ListView(
|
return ListView(
|
||||||
children: <Widget>[
|
children: jobWidgets
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Widget> _createjobWidgets() {
|
||||||
|
List<Widget> jobWidgets = [];
|
||||||
|
|
||||||
|
for (var job in _jobs) {
|
||||||
|
jobWidgets.add(
|
||||||
ListTile(
|
ListTile(
|
||||||
title: const Column(
|
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,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
'Dies ist ein linksbündigerText',
|
DateFormat('dd.MM.yyyy HH:mm').format(DateTime.parse(job.ordertime)).toString(),
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'Dies ist ein linksbündiger Text',
|
job.crFilter != null ? job.crFilter.toString() : "",
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.blue,
|
|
||||||
fontSize: 24.0,
|
|
||||||
),
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Image.asset("assets/${mapVehicleTypeToImageName(job.vhtId)}", width: 60, height: 60),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
Text(
|
||||||
|
mapVehicleTypeToText(job.vhtId)
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
onTap: () {
|
Text(
|
||||||
_clicked();
|
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, readOnly: true,));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -205,7 +205,7 @@ class _MainPageState extends State<MainPage> {
|
|||||||
getDefaultButton(
|
getDefaultButton(
|
||||||
'Abmelden',
|
'Abmelden',
|
||||||
image: Image.asset('assets/abmelden.png', width: 30, height: 30),
|
image: Image.asset('assets/abmelden.png', width: 30, height: 30),
|
||||||
() => {BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const FinishedJobsPage())}),
|
() => {}),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
|
|||||||
@@ -21,10 +21,12 @@ import '../model/task_info.dart';
|
|||||||
import '../tools/util.dart';
|
import '../tools/util.dart';
|
||||||
|
|
||||||
class TaskListPage extends ContentViewWidget {
|
class TaskListPage extends ContentViewWidget {
|
||||||
const TaskListPage({super.key, required this.tour});
|
const TaskListPage({super.key, required this.tour, this.readOnly = false});
|
||||||
|
|
||||||
final JobTour tour;
|
final JobTour tour;
|
||||||
|
|
||||||
|
final bool readOnly;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<TaskListPage> createState() => _TaskListPageState();
|
State<TaskListPage> createState() => _TaskListPageState();
|
||||||
|
|
||||||
@@ -80,11 +82,14 @@ class _TaskListPageState extends State<TaskListPage> {
|
|||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
scrollDirection: Axis.vertical,
|
scrollDirection: Axis.vertical,
|
||||||
padding: const EdgeInsets.all(0),
|
padding: const EdgeInsets.all(0),
|
||||||
|
child: AbsorbPointer(
|
||||||
|
absorbing: widget.readOnly,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: steps,
|
children: steps,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,11 +11,14 @@ import '../tools/constants.dart';
|
|||||||
import '../tools/util.dart';
|
import '../tools/util.dart';
|
||||||
|
|
||||||
class TourDetailsPage extends ContentViewWidget {
|
class TourDetailsPage extends ContentViewWidget {
|
||||||
const TourDetailsPage({super.key, required this.job, required this.tour});
|
const TourDetailsPage({super.key, required this.job, required this.tour, this.readOnly = false});
|
||||||
|
|
||||||
final Job job;
|
final Job job;
|
||||||
final JobTour tour;
|
final JobTour tour;
|
||||||
|
|
||||||
|
final bool readOnly;
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<TourDetailsPage> createState() => _TourDetailsPageState();
|
State<TourDetailsPage> createState() => _TourDetailsPageState();
|
||||||
|
|
||||||
@@ -139,7 +142,7 @@ class _TourDetailsPageState extends State<TourDetailsPage> {
|
|||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
getDefaultButton('Weiter', () =>
|
getDefaultButton('Weiter', () =>
|
||||||
{
|
{
|
||||||
BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: TaskListPage(tour: widget.tour))
|
BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: TaskListPage(tour: widget.tour, readOnly: widget.readOnly))
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -11,10 +11,12 @@ import '../tools/constants.dart';
|
|||||||
import '../tools/util.dart';
|
import '../tools/util.dart';
|
||||||
|
|
||||||
class TourListPage extends ContentViewWidget {
|
class TourListPage extends ContentViewWidget {
|
||||||
const TourListPage({super.key, required this.job});
|
const TourListPage({super.key, required this.job, this.readOnly = false});
|
||||||
|
|
||||||
final Job job;
|
final Job job;
|
||||||
|
|
||||||
|
final bool readOnly;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<TourListPage> createState() => _TourListPageState();
|
State<TourListPage> createState() => _TourListPageState();
|
||||||
|
|
||||||
@@ -192,7 +194,7 @@ class _TourListPageState extends State<TourListPage> {
|
|||||||
|
|
||||||
void _clicked(JobTour tour) {
|
void _clicked(JobTour tour) {
|
||||||
if (tour.state == 0) {
|
if (tour.state == 0) {
|
||||||
BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: TourDetailsPage(job: widget.job, tour: tour));
|
BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: TourDetailsPage(job: widget.job, tour: tour, readOnly: widget.readOnly));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user