Update price layout in marker view

This commit is contained in:
Thomas Fransolet 2024-07-03 16:22:11 +02:00
parent 89aeb4086f
commit da557503fc

View File

@ -46,6 +46,8 @@ class _MarkerInfoWidget extends State<MarkerViewWidget> {
@override
Widget build(BuildContext context) {
int breakPointPrice = 40;
Size size = MediaQuery.of(context).size;
final mapContext = Provider.of<MapContext>(context);
final appContext = Provider.of<AppContext>(context);
@ -53,6 +55,9 @@ class _MarkerInfoWidget extends State<MarkerViewWidget> {
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<MarkerViewWidget> {
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<MarkerViewWidget> {
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<MarkerViewWidget> {
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<MarkerViewWidget> {
),
),
),
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<MarkerViewWidget> {
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<MarkerViewWidget> {
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<MarkerViewWidget> {
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: [