From 321ddfc4a0b24c8a3de422184c4bb4e2bbee67d9 Mon Sep 17 00:00:00 2001 From: Karan Sharma <55722391+ksharma-xyz@users.noreply.github.com> Date: Wed, 23 Oct 2024 23:30:52 +1100 Subject: [PATCH] Update timeline color to match actual line color of transport mode --- .../krail/trip/planner/ui/components/LegView.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/feature/trip-planner/ui/src/main/kotlin/xyz/ksharma/krail/trip/planner/ui/components/LegView.kt b/feature/trip-planner/ui/src/main/kotlin/xyz/ksharma/krail/trip/planner/ui/components/LegView.kt index 97069e83..f30f7238 100644 --- a/feature/trip-planner/ui/src/main/kotlin/xyz/ksharma/krail/trip/planner/ui/components/LegView.kt +++ b/feature/trip-planner/ui/src/main/kotlin/xyz/ksharma/krail/trip/planner/ui/components/LegView.kt @@ -15,6 +15,7 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -50,6 +51,7 @@ fun LegView( val density = LocalDensity.current // todo can be reusable logic for consistent icon size val iconSize = with(density) { 14.sp.toDp() } + val timelineColor = remember(transportModeLine) { transportModeLine.lineColorCode.hexToComposeColor() } Column( modifier = modifier @@ -103,7 +105,7 @@ fun LegView( isProminent = true, modifier = Modifier .timeLineTop( - color = transportModeLine.transportMode.colorCode.hexToComposeColor(), + color = timelineColor, strokeWidth = strokeWidth, circleRadius = circleRadius, ) @@ -113,7 +115,7 @@ fun LegView( Column( modifier = Modifier .timeLineCenter( - color = transportModeLine.transportMode.colorCode.hexToComposeColor(), + color = timelineColor, strokeWidth = strokeWidth, ) .padding(start = 16.dp, top = 12.dp), @@ -141,12 +143,12 @@ fun LegView( isProminent = false, modifier = Modifier .timeLineCenterWithStop( - color = transportModeLine.transportMode.colorCode.hexToComposeColor(), + color = timelineColor, strokeWidth = strokeWidth, circleRadius = circleRadius, ) .timeLineTop( - color = transportModeLine.transportMode.colorCode.hexToComposeColor(), + color = timelineColor, strokeWidth = strokeWidth, circleRadius = circleRadius, ) @@ -161,7 +163,7 @@ fun LegView( isProminent = true, modifier = Modifier .timeLineBottom( - color = transportModeLine.transportMode.colorCode.hexToComposeColor(), + color = timelineColor, strokeWidth = strokeWidth, circleRadius = circleRadius, )