Have the content fill (possibly only partially) the [Constraints.
FillHalfSizeModifier
@Composable
fun FillHalfSizeModifier() {
Box(Modifier.requiredSize(100.dp).background(Color.Red), contentAlignment = Alignment.Center) {
// The inner Box will be (50.dp x 50.dp).
Box(Modifier.requiredWidth(30.dp).fillMaxSize(0.5f).background(color = Color.Magenta))
}
}
SimpleFillModifier
@Composable
fun SimpleFillModifier() {
Box(Modifier.fillMaxSize().background(Color.Red), contentAlignment = Alignment.Center) {
Box(Modifier.size(100.dp).background(color = Color.Magenta))
}
}