How do I make something like this but wrap the hei...
# compose
s
How do I make something like this but wrap the height to get rid of the extra space? I understand it's because of the
aspectRatio(1f)
but whatever height I use, the arc only fills half of it. Code in thread.
👍 1
Copy code
Canvas(
    modifier = modifier
        .background(Color.Blue)
        .aspectRatio(1f)
        .padding(24.dp)
) {
    drawArc(
        brush = Brush.sweepGradient(
            0.5f to Color.Red,
            1f to Color.Green
        ),
        startAngle = 0f,
        sweepAngle = -180f,
        useCenter = false,
        style = Stroke(width = 100f)
    )
}
a
You need to specify
size = Size(this.size.width, this.size.height * 2)
.
s
Oh got it. Thanks!