From 20a1309946316e1ca819782c4fbfd76f94432334 Mon Sep 17 00:00:00 2001 From: Sven Carstensen Date: Thu, 8 Feb 2024 18:03:04 +0100 Subject: [PATCH] Erweiterungen --- lib/content_views/tour_list_page.dart | 113 ++++++++++++-------------- 1 file changed, 51 insertions(+), 62 deletions(-) diff --git a/lib/content_views/tour_list_page.dart b/lib/content_views/tour_list_page.dart index 7381899..22ac92d 100644 --- a/lib/content_views/tour_list_page.dart +++ b/lib/content_views/tour_list_page.dart @@ -93,38 +93,32 @@ class _TourListPageState extends State { Image.asset("assets/${mapVehicleTypeToImageName(widget.job.vhtId)}", width: 60, height: 60), const SizedBox(width: 10), Expanded( - child: Text( - mapVehicleTypeToText(widget.job.vhtId) - ), + child: Text(mapVehicleTypeToText(widget.job.vhtId)), ), const SizedBox(width: 10), SizedBox( - width: 100, - child: Visibility( - visible: widget.job.tours[0].pos != null, - child: ElevatedButton( - style: ButtonStyle( - shape: MaterialStateProperty.all( - RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8.0), - side: const BorderSide(color: Colors.grey), + width: 100, + child: Visibility( + visible: widget.job.tours[0].pos != null, + child: ElevatedButton( + style: ButtonStyle( + shape: MaterialStateProperty.all( + RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8.0), + side: const BorderSide(color: Colors.grey), + ), ), + backgroundColor: MaterialStateProperty.all(Colors.lightGreen), + foregroundColor: MaterialStateProperty.all(Colors.black), ), - backgroundColor: MaterialStateProperty.all(Colors.lightGreen), - foregroundColor: MaterialStateProperty.all(Colors.black), - ), - onPressed: () => { showMapPopup(context, widget.job.tours[0], widget.job.tours)}, - child: const Text("Karte")), - )) + onPressed: () => {showMapPopup(context, widget.job.tours[0], widget.job.tours)}, + child: const Text("Karte")), + )) ], ), Expanded( - child: ListView( - padding: const EdgeInsets.all(0), - children: jobWidgets - ), + child: ListView(padding: const EdgeInsets.all(0), children: jobWidgets), ) - ], ), ); @@ -135,7 +129,7 @@ class _TourListPageState extends State { for (var tour in _tours) { Color color = Colors.transparent; - switch(tour.state) { + switch (tour.state) { case 0: color = Colors.white; break; @@ -151,41 +145,37 @@ class _TourListPageState extends State { 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: [ - 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, - ), - ], - ), - ) - ), + 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: [ + 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, + ), + ], + ), + )), ); } @@ -193,8 +183,7 @@ class _TourListPageState extends State { } void _clicked(JobTour tour) { - if (tour.state == 0) { - MessageService().publish(Constants.messageTopicPushContentView, arguments: TourDetailsPage(job: widget.job, tour: tour, readOnly: widget.readOnly)); - } + MessageService().publish(Constants.messageTopicPushContentView, + arguments: TourDetailsPage(job: widget.job, tour: tour, readOnly: tour.state != 0)); } }