'Border stroke not same on left and right side in custom shape
I'm trying to create an arrow without bottom line but when I'm applying border stroke. left side and right side border width and color are showing up different. Any idea why this is happening or any different approach to get arrow with border and a color to fill inside the arrow
Box(
modifier
.fillMaxWidth()
.height(height)
.border(border = BorderStroke(1.dp,borderColor), shape = DrawTriangleShape())
.background(color = color, shape = DrawTriangleShape())
)
class DrawTriangleShape : Shape {
override fun createOutline(size: Size, layoutDirection: LayoutDirection, density: Density): Outline {
val trianglePath = Path().apply {
moveTo((size.width / 2 ) - with(density) { 10.dp.toPx() }, size.height)
lineTo((size.width / 2), 0f)
lineTo((size.width / 2 ) + with(density) { 10.dp.toPx() }, size.height)
}
return Outline.Generic(path = trianglePath)
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

