From da557503fcf010317b7b4174c80e44307d65045b Mon Sep 17 00:00:00 2001 From: Thomas Fransolet Date: Wed, 3 Jul 2024 16:22:11 +0200 Subject: [PATCH] Update price layout in marker view --- lib/Screens/Map/marker_view.dart | 73 ++++++++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 4 deletions(-) diff --git a/lib/Screens/Map/marker_view.dart b/lib/Screens/Map/marker_view.dart index 48cf437..752f594 100644 --- a/lib/Screens/Map/marker_view.dart +++ b/lib/Screens/Map/marker_view.dart @@ -46,6 +46,8 @@ class _MarkerInfoWidget extends State { @override Widget build(BuildContext context) { + int breakPointPrice = 40; + Size size = MediaQuery.of(context).size; final mapContext = Provider.of(context); final appContext = Provider.of(context); @@ -53,6 +55,9 @@ class _MarkerInfoWidget extends State { var language = tabletAppContext.language; GeoPointDTO? selectedPoint = mapContext.getSelectedPoint() as GeoPointDTO?; + ScrollController scrollDescription = new ScrollController(); + ScrollController scrollPrice = new ScrollController(); + var isPointPrice = selectedPoint != null && selectedPoint.prices != null && selectedPoint.prices!.isNotEmpty && selectedPoint.prices!.any((d) => d.language == language) && selectedPoint.prices!.firstWhere((d) => d.language == language).value != null && selectedPoint.prices!.firstWhere((d) => d.language == language).value!.trim().length > 0; Color primaryColor = new Color(int.parse(tabletAppContext.configuration!.primaryColor!.split('(0x')[1].split(')')[0], radix: 16)); @@ -153,7 +158,7 @@ class _MarkerInfoWidget extends State { child: Container( //color: Colors.green, height: size.height * 0.06, - width: size.width * 0.75, + width: size.width * 0.65, child: HtmlWidget( selectedPoint.title!.firstWhere((t) => t.language == language).value!, textStyle: TextStyle(fontSize: 23.0), @@ -168,7 +173,7 @@ class _MarkerInfoWidget extends State { child: Column( children: [ Container( - height: isPointPrice ? size.height * 0.45 : size.height * 0.7, + height: isPointPrice && selectedPoint.prices!.firstWhere((d) => d.language == language).value!.length > breakPointPrice ? size.height * 0.45 : size.height * 0.7, width: size.width * 0.38, decoration: BoxDecoration( color: kBackgroundLight, @@ -177,9 +182,11 @@ class _MarkerInfoWidget extends State { child: Padding( padding: const EdgeInsets.only(left: 20, right: 10, bottom: 10, top: 15), child: Scrollbar( + controller: scrollDescription, thumbVisibility: true, thickness: 2.0, child: SingleChildScrollView( + controller: scrollDescription, child: Padding( padding: const EdgeInsets.all(8.0), child: Column( @@ -201,7 +208,7 @@ class _MarkerInfoWidget extends State { ), ), ), - if(isPointPrice) + if(isPointPrice && selectedPoint.prices!.firstWhere((d) => d.language == language).value!.length > breakPointPrice) Container( height: size.height * 0.25, width: size.width * 0.38, @@ -212,9 +219,11 @@ class _MarkerInfoWidget extends State { child: Padding( padding: const EdgeInsets.only(left: 20, right: 10, bottom: 10, top: 15), child: Scrollbar( + controller: scrollPrice, thumbVisibility: true, thickness: 2.0, child: SingleChildScrollView( + controller: scrollPrice, child: Padding( padding: const EdgeInsets.all(8.0), child: Column( @@ -226,7 +235,7 @@ class _MarkerInfoWidget extends State { child: Icon(Icons.price_change_outlined, color: primaryColor, size: 25), )), HtmlWidget( - selectedPoint.prices!.firstWhere((d) => d.language == language).value!+"sdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsd sdkljsdkj sdklj sldkj klsdj klsdj klsd", + selectedPoint.prices!.firstWhere((d) => d.language == language).value!, customStylesBuilder: (element) { return {'text-align': 'left', 'font-family': "Roboto"}; }, @@ -282,6 +291,62 @@ class _MarkerInfoWidget extends State { padding: const EdgeInsets.only(top: 10.0), child: Column( children: [ + /*if(isPointPrice && selectedPoint.prices!.firstWhere((d) => d.language == language).value!.length > breakPointPrice) + Container( + height: size.height * 0.1, + width: size.width * 0.38, + decoration: BoxDecoration( + color: kBackgroundLight, + borderRadius: BorderRadius.all(Radius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)) + ), + child: Padding( + padding: EdgeInsets.all(5), + child: Scrollbar( + thumbVisibility: true, + thickness: 2.0, + child: SingleChildScrollView( + child: Padding( + padding: EdgeInsets.all(5.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + // todo add width ? + Padding( + padding: const EdgeInsets.all(5.0), + child: Icon(Icons.price_change_outlined, color: primaryColor, size: 13), + ), + HtmlWidget( + selectedPoint.prices!.firstWhere((d) => d.language == language).value!, + customStylesBuilder: (element) { + return {'text-align': 'left', 'font-family': "Roboto"}; + }, + textStyle: TextStyle(fontSize: 12), + ), + ], + ), + ), + ), + ), + ), + ),*/ + if(isPointPrice && selectedPoint.prices!.firstWhere((d) => d.language == language).value!.length <= breakPointPrice) + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Icon(Icons.price_change_outlined, color: primaryColor, size: 13), + Padding( + padding: const EdgeInsets.all(4.0), + child: HtmlWidget( + selectedPoint.prices!.firstWhere((d) => d.language == language).value!, + customStylesBuilder: (element) { + return {'text-align': 'left', 'font-family': "Roboto"}; + }, + textStyle: TextStyle(fontSize: 12), + ), + ) + ], + ), selectedPoint.phone != null && selectedPoint.phone!.isNotEmpty && selectedPoint.phone!.any((d) => d.language == language) && selectedPoint.phone!.firstWhere((d) => d.language == language).value != null && selectedPoint.phone!.firstWhere((d) => d.language == language).value!.trim().length > 0 ? Row( mainAxisAlignment: MainAxisAlignment.start, children: [