154 lines
4.9 KiB
Dart
154 lines
4.9 KiB
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/content_views/utils/header_info.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<HeaderInfo> getHeaderInfo(BuildContext context) async {
|
|
return HeaderInfo(
|
|
titleWidget: const Text(
|
|
'Details der Station',
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 20.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) {
|
|
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(context, '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', () =>
|
|
{
|
|
MessageService().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: TaskListPage(job: widget.job, tour: widget.tour, readOnly: widget.readOnly))
|
|
}),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|