I wanted the rounded curve around the corner of triangle in left and right. I tried to add arc but I don't know it's not working maybe the coordinate are wrong . Or any other methods ?
@Composable
fun NavBarCustomShape() {
Canvas(modifier = Modifier.fillMaxWidth().height(64.dp)){
val rect = Rect(Offset.Zero, size)
val trianglePath = Path().apply {
// Moves to top center position
moveTo(x = rect.topCenter.x, y = 27.dp.toPx())
// Add line to bottom right corner
lineTo(x = rect.bottomCenter.x - 37.dp.toPx(), y = rect.bottomLeft.y )
// Add line to bottom left corner
lineTo(x = rect.bottomCenter.x + 37.dp.toPx(), y = rect.bottomRight.y)
// moveTo(x = rect.bottomCenter.x - 32.dp.toPx(), y = rect.bottomLeft.y )
// addArc(
// Rect(
// offset = Offset(rect.bottomCenter.x - 32.dp.toPx(),rect.bottomRight.y),
// size = Size(24.dp.toPx(),24.dp.toPx())
// ),
// startAngleDegrees = 0f,
// sweepAngleDegrees = 90f,
// )
close()
}
rotate(180f)
{
clipPath(trianglePath, clipOp = ClipOp.Difference)
{
drawRect(color = purple)
}
}
}
}
Result shape :-
Required shape is :-