dashedBorder

fun Modifier.dashedBorder(width: Dp, color: Color, shape: Shape = RectangleShape, intervals: List<Dp> = listOf(width * 2, width * 2), phase: Dp = 0.dp): Modifier

Modify element to add a dashed border styled with appearance specified with a width, a color and a shape, and clip it.

The intervals must contain an even number of entries (>=2). The even indices specify "on" intervals and the odd indices represent "off" intervals. The phase is the pixel offset into the intervals list (mod the sum of all of the intervals).

For example: if intervals = listOf(10.dp, 20.dp), and phase = 25.dp, this will set up a dashed border like so: 5 dps off 10 dps on 20 dps off 10 dps on 20 dps off

Parameters

width

Thickness of the border in dp.

color

Color to paint the border with.

shape

Shape of the border.

intervals

List of "on" and "off" distances for the dashed line segments.

phase

Pixel offset into the intervals list.