Fill height for child in Row

You have to apply Modifier.height(IntrinsicSize.Min) to the Row and the fillMaxHeight() modifier to the 2nd Box.

Something like:

Card(shape = RoundedCornerShape(8.dp)) {
    Row(
        modifier = Modifier.height(IntrinsicSize.Min) //Intrinsic measurement
    ) {
        Box(
            Modifier
                .background(Color.Yellow)
                .weight(1f)
        ) {
            //Box(Modifier.height(50.dp))
        }

        Box(
            Modifier
                .width(20.dp)
                .fillMaxHeight()  //<--- fill max height
                .background(Color.Green)
        ) {
            //........
        }
    }
}

enter image description here

As explained in the doc:

The Row composable’s minIntrinsicHeight will be the maximum minIntrinsicHeight of its children. The Green Box element’s minIntrinsicHeight is 0 as it doesn’t occupy space if no constraints are given; the Yellow Box minIntrinsicHeight will be that of the content given a specific width. Therefore, the Row element’s height constraint will be the max minIntrinsicHeight of the Yellow Box content. The Green Box will then expand its height to the height constraint given by the Row.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)