kecaroh
09/26/2023, 2:01 PMkecaroh
09/26/2023, 2:02 PM.onSizeChanged {
onHeightMeasured((it.height / 2).dp)
}
Outside the timeline row composable, I would save this value to a variable:
var boxHeight by remember {
mutableStateOf(0.dp)
}
onHeightMeasured = {
boxHeight = it
}
Then, in a LazyColumn, I tried to pass this box height (as in previous box height) to the next timeline row, which I would then use to draw the timeline line. This time, I would only draw one line, starting in the centre of a timeline row left box and ending in the middle of the box's top edge with previous box height substracted:
itemsIndexed(steps) { index, step ->
val previousBoxHeight = boxHeight
TimelineRow(
onHeightMeasured = {
boxHeight = it
},
previousBoxHeight = previousBoxHeight
...
drawLine(
color = Color.Black,
strokeWidth = 6f,
start = Offset(size.width / 2, size.height / 2),
end = Offset(size.width / 2, 0f - previousBoxHeight.toPx())
)
This solution however did not work, items in the list would be placed first, then it would measure its heights and it was a mess overall. Then i tried to somehow access next item in the list and change its color of the top line but i couldn't make it work and it was too hacky.
I am not asking for a concrete solution, but if anyone here may know how to solve it (so that nodes are in the middle of the timeline row, lines connect them and are colored as they should), please let me know. Thank you so much.Albert Chang
09/26/2023, 2:16 PMKevin Worth
09/26/2023, 2:44 PMkecaroh
09/27/2023, 7:28 AMandrew
10/05/2023, 3:19 PMandrew
10/05/2023, 3:19 PMPushpal Roy
03/21/2024, 6:38 AM