Declare the height of the content to be exactly the same as the min or max intrinsic height of the content.
SimpleRequiredHeightModifier
@Composable
fun SimpleRequiredHeightModifier() {
// The result is a 50.dp x 50.dp blue box centered in a 100.dp x 100.dp space.
// Note that although a previous modifier asked it to be 100.dp height, this
// will not be respected. They would be respected if height was used instead of requiredHeight.
Box(
Modifier.requiredHeight(100.dp).requiredHeight(50.dp).aspectRatio(1f).background(Color.Blue)
)
}