248 lines
8.3 KiB
Dart
248 lines
8.3 KiB
Dart
import 'package:dart_mq/dart_mq.dart';
|
|
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/messages/pop_content_view_message.dart';
|
|
import 'package:stadtbote/model/job_tour.dart';
|
|
import 'package:stadtbote/tools/message_service.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, this.readOnly = false});
|
|
|
|
final Job job;
|
|
|
|
final JobTour tour;
|
|
|
|
final bool readOnly;
|
|
|
|
@override
|
|
State<TourDetailsPage> createState() => _TourDetailsPageState();
|
|
|
|
@override
|
|
Future<Widget> getHeaderWidget(BuildContext context) async {
|
|
await Future.delayed(const Duration(microseconds: 0));
|
|
|
|
return _HeaderWidget();
|
|
}
|
|
}
|
|
|
|
class _TourDetailsPageState extends State<TourDetailsPage> with ProducerMixin {
|
|
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) {
|
|
remark += '${widget.tour.rem}\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', () =>
|
|
{
|
|
if (widget.tour.pos != null) {
|
|
showMapPopup(context, widget.tour, widget.job.tours)
|
|
} else {
|
|
showAlertDialog('Information', 'Es liegt keine Position für diese Station vor')
|
|
}
|
|
}),
|
|
],
|
|
),
|
|
)
|
|
),
|
|
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: [
|
|
Expanded(child: SingleChildScrollView(child: Text(remark))),
|
|
]
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 10),
|
|
getDefaultButton('Weiter', () async =>
|
|
{
|
|
// TODO MESSAGING
|
|
sendMessage(
|
|
routingKey: Constants.messageTopicPushContentView,
|
|
payload: TaskListPage(job: widget.job, tour: widget.tour, readOnly: widget.readOnly),
|
|
)
|
|
|
|
//await MessageService().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: TaskListPage(job: widget.job, tour: widget.tour, readOnly: widget.readOnly))
|
|
}),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _HeaderWidget extends StatefulWidget {
|
|
@override
|
|
State<_HeaderWidget> createState() => _HeaderWidgetState();
|
|
}
|
|
|
|
class _HeaderWidgetState extends State<_HeaderWidget> with ProducerMixin {
|
|
@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 {
|
|
// TODO MESSAGING
|
|
sendMessage(
|
|
routingKey: Constants.messageTopicPopContentView,
|
|
payload: PopContentViewMessage(count: 1),
|
|
);
|
|
|
|
//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 {
|
|
// TODO MESSAGING
|
|
sendMessage(
|
|
routingKey: Constants.messageTopicPopContentView,
|
|
payload: PopContentViewMessage(count: 1),
|
|
);
|
|
|
|
//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),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
} |