Hey guys, I am having weird problem with `._height...
# compose
r
Hey guys, I am having weird problem with
._height_(IntrinsicSize._Max_)
in some cases the first item in a
Row
measures wrong. Look at these three previews of the same composable but rendered with different widths: (picture below). Not that it is ellipsized for 375dp width but not for 370 nor 380 (I am pasting minimum source code inside the thread)
Copy code
@Preview(widthDp = 370, backgroundColor = 0xFFFFFFFF)
@Composable
fun width370() {
    Test()
}

@Preview(widthDp = 375, backgroundColor = 0xFFFFFFFF)
@Composable
fun width375() {
    Test()
}

@Preview(widthDp = 380, backgroundColor = 0xFFFFFFFF)
@Composable
fun width380() {
    Test()
}

@Composable
fun Test() {
    Surface {
        val items = (0..3).map {
            if (it % 2 == 1) {
                "Cateogry $it"
            } else {
                "Two lines Cateogry $it"
            }
        }

        Row(
            modifier = Modifier.padding(horizontal = 16.dp).fillMaxWidth()
                .height(IntrinsicSize.Max),
            horizontalArrangement = spacedBy(16.dp),
        ) {
            items.forEach {
                Column(
                    modifier = Modifier.weight(1f).fillMaxHeight().border(2.dp, Color.Red),
                    verticalArrangement = spacedBy(16.dp),
                ) {
                    Box(
                        modifier = Modifier
                            .fillMaxWidth()
                            .aspectRatio(1f),
                    )

                    Text(
                        text = it,
                        textAlign = TextAlign.Center,
                        overflow = TextOverflow.Ellipsis,
                        softWrap = true,
                        maxLines = 2,
                    )
                }
            }
        }
    }
}
z
Please file a bug
r
@Zach Klippenstein (he/him) [MOD] filed here: https://issuetracker.google.com/issues/296990888
z
Thanks!