Samir Basnet
03/01/2021, 8:01 AM@Composable
fun ProgressStep(modifier:Modifier,max: Int, current: Int) {
Layout(modifier = modifier,
content = {
for (i in 1..max)
StepCircle(step = i, color = if (i <= current) purple else Color.Gray)
}) { measurables, constraints ->
val startPoint = (constraints.maxWidth/max)/2
val placeables = measurables.map { measurable ->
measurable.measure(constraints.copy(minWidth = 0))
}
layout(constraints.maxWidth, constraints.minWidth) {
var xPosition = startPoint
placeables.forEachIndexed { index, placeable ->
placeable.place(x = xPosition-11, y = constraints.maxHeight / 2)
xPosition += (startPoint * 2)
}
}
}
}
i noticed the mesurements here are accepted in Integer so the gap after the last item in less compared to others. how am i supposed to gap equally here?Samir Basnet
03/01/2021, 8:02 AM