That should just be adding this modifier to the Row instead of the text
Row(
horizontalArrangement = Arrangement.SpaceBetween,
modifier = Modifier.fillMaxWidth().graphicsLayer(compositingStrategy = CompositingStrategy.Offscreen)
.drawWithContent {
drawContent()
val cornerRadius = CornerRadius(size.height / 2)
// Overwrite text color
val progressPercentage = 0.1f
drawRoundRect(
color = Color.White,
size = Size(size.width * progressPercentage, size.height),
cornerRadius = cornerRadius,
blendMode = BlendMode.SrcIn
)
// Draw green background
drawRoundRect(
color = Color(0xFF008528),
size = Size(size.width * progressPercentage, size.height),
cornerRadius = cornerRadius,
blendMode = BlendMode.DstOver
)
// Draw gray background
drawRoundRect(
color = Color(0xFFD7DBE0),
cornerRadius = cornerRadius,
blendMode = BlendMode.DstOver
)
}
) {
Text(
text = "12345",
fontWeight = FontWeight.Bold,
color = Color(0xFF404B5B),
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp)
)
Text(
text = "67890",
fontWeight = FontWeight.Bold,
color = Color(0xFF404B5B),
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp)
)
}