I want to create a modifier that will offset the c...
# compose
m
I want to create a modifier that will offset the content in the x axis by a specific amount, and then draw a background filling that space. What is the best way of accomplish that ?
this will work. Idk if its the best solution
Copy code
fun Modifier.stride(
    color: Color,
    width: Dp = 4.dp
): Modifier {
    return this.then(
        composed {
            val strideWidth = with(LocalDensity.current) {
                width.toPx()
            }
            drawBehind {
                drawRoundRect(
                    color = color,
                    size = Size(
                        width = strideWidth,
                        height = this.size.height
                    )
                )
            }
        }
    ).then(Modifier.padding(start = width))
}