How to draw the given shape as the image below using jetpack compose
Heres what i have tried and formed so far …
I have tried the following with the cide mentioned belwo :-
Shape.kt
@Composable
fun TriangularCurve() {
Column(
modifier = Modifier
.fillMaxSize()
.background(color = Color.Gray),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Box(
modifier = Modifier
.drawWithCache {
val path = Path().apply {
moveTo(size.width * 0.1f, size.height)
cubicTo(
size.width * 0.25f, size.height * 0.5f, // First control point for gentle slope
size.width * 0.75f, size.height * 0.5f, // Second control point for gentle slope
size.width * 0.9f, size.height,// End point
)
lineTo(size.width * 0.9f, size.height) // Ensure we are at the bottom-right corner
lineTo(size.width * 0.1f, size.height) // Line back to the bottom-left corner
close()
}
onDrawBehind {
drawPath(path, color = Color.Green, style = Fill)
}
}
.size(300.dp,200.dp)
)
}
}