Luis Daivid

    Luis Daivid

    1 year ago
    I want to draw a view like the image below, but I don’t know how. The text is centered, and the length of the dotted line must be filled to fit the screen size.
    Colton Idle

    Colton Idle

    1 year ago
    Create a dashed line composable
    @Composable
    private fun DashedLine() {
        Canvas(modifier = Modifier.fillMaxWidth()) {
            drawLine(
                color = Color(0xff212121),
                start = Offset(0f, 0f),
                end = Offset(size.width - 1, 0f),
                strokeWidth = 6f,
                pathEffect = PathEffect.dashPathEffect(floatArrayOf(10f, 10f), 0f),
            )
        }
    }
    and then just have a Row { DashedLine Text DashedLine } and apply a weight modifier to the dashed lines of 1f