how can i draw the different sides of a border with a different color? I would like to draw the top and left sides a different color to the right and bottom.
this is fairly easy to do with design tools (such as figma).
o
Oleksandr Balan
04/24/2023, 4:38 PM
I think you could mimic it with several background modifiers, something like that:
Copy code
@Preview
@Composable
fun BordersPreview() {
val borderWidth = 8.dp
val borderShape = RectangleShape
Box(
modifier = Modifier
.size(100.dp)
.background(Color.Cyan, borderShape)
.padding(start = borderWidth, top = borderWidth)
.background(Color.Yellow, borderShape)
.padding(end = borderWidth, bottom = borderWidth)
.background(Color.White, borderShape)
)
}
Oleksandr Balan
04/24/2023, 4:41 PM
With rounded corner shape it looks weird, but cool as for me 😅