Thread
#compose
    Samir Basnet

    Samir Basnet

    1 year ago
    @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?
    By the way that 11 is the radius of that StepCircle