I can't figure out a way to do it with rounded borders, but this works if it's a standard rectangle:
Card(
modifier = Modifier
.height(itemHeight)
.width(itemWidth),
) {
Box(Modifier.fillMaxSize()) {
Column {
//your content
}
Canvas(Modifier.fillMaxSize()) {
val canvasWidth = size.width
val canvasHeight = size.height
drawLine( //top line
start = Offset(x = 0f, y = 0f),
end = Offset(x = canvasWidth, y = 0f),
strokeWidth = 3f,
color = Color.Blue
)
drawLine( //bottom line
start = Offset(x = 0f, y = canvasHeight),
end = Offset(x = canvasWidth, y = canvasHeight),
strokeWidth = 3f,
color = Color.Green
)
drawLine( //left line
start = Offset(x = 0f, y = 0f),
end = Offset(x = 0f, y = canvasHeight),
strokeWidth = 3f,
color = Color.Magenta
)
drawLine( //right line
start = Offset(x = canvasWidth, y = 0f),
end = Offset(x = canvasWidth, y = canvasHeight),
strokeWidth = 3f,
color = Color.Red
)
}
}
}