I would use a simple
Box
with a background color of the status, which will fill the
Card
height. The content height should be set to
IntrinsicSize.Min
, so that card is not expanded to the max available height, see
intrinsic measurements.
So something like this could do the trick:
@Composable
private fun StatusCard(
statusColor: Color,
modifier: Modifier = Modifier,
content: @Composable () -> Unit
) {
Card(modifier) {
Row(Modifier.height(IntrinsicSize.Min)) {
content()
Box(
modifier = Modifier
.fillMaxHeight()
.width(8.dp)
.background(statusColor)
)
}
}
}
And usage:
StatusCard(Color.Red) {
Text(
text = "Lorem ipsum",
modifier = Modifier.padding(8.dp)
)
}