how do I make VerticalDivider a dotted line ?
# compose
u
how do I make VerticalDivider a dotted line ?
s
You can't with the version from M3, here's one you can pass a
pathEffect
to.
Copy code
@Composable
fun VerticalDivider(
    pathEffect: PathEffect,
    modifier: Modifier = Modifier,
    thickness: Dp = DividerDefaults.Thickness,
    color: Color = DividerDefaults.color,
) = Canvas(modifier.fillMaxHeight().width(thickness)) {
    drawLine(
        color = color,
        strokeWidth = thickness.toPx(),
        start = Offset(thickness.toPx() / 2, 0f),
        end = Offset(thickness.toPx() / 2, size.height),
        pathEffect = pathEffect,
    )
}
VerticalDivider(PathEffect.dashPathEffect(floatArrayOf(10f, 10f), 0f)
👍 1
u
thanks - how do I set the radious for each dot ?
s