Colton Idle

    Colton Idle

    11 months ago
    How can I make these all the same height? Or maybe a more accurate way to put it. How can I make all items in a row, the height of the largest item in the row, while the row itself wraps the content.
    Row(modifier = Modifier.horizontalScroll(rememberScrollState())) {
        Button(onClick = { /*TODO*/ }, modifier = Modifier.fillMaxHeight().border(1.dp, Color.Green)
        ) { Text(text = "One") }
        Button(onClick = { /*TODO*/ }, modifier = Modifier.fillMaxHeight().border(1.dp, Color.Green)
        ) { Text(text = "Two\nTwo\nTwo") }
        Button(onClick = { /*TODO*/ }, modifier = Modifier.fillMaxHeight().border(1.dp, Color.Green)
        ) { Text(text = "Three") }
    }
    Francesc

    Francesc

    11 months ago
    You can use
    IntrinsicSize.min
    for this
    Box(modifier = Modifier.height(128.dp).fillMaxWidth()) {
            Row(modifier = Modifier
                .height(IntrinsicSize.Min)
                .horizontalScroll(rememberScrollState())) {
                Button(
                    onClick = { /*TODO*/ }, modifier = Modifier
                        .fillMaxHeight()
                        .border(1.dp, Color.Green)
                ) { Text(text = "One") }
                Button(
                    onClick = { /*TODO*/ }, modifier = Modifier
                        .fillMaxHeight()
                        .border(1.dp, Color.Green)
                ) { Text(text = "Two\nTwo\nTwo") }
                Button(
                    onClick = { /*TODO*/ }, modifier = Modifier
                        .fillMaxHeight()
                        .border(1.dp, Color.Green)
                ) { Text(text = "Three") }
            }
        }
    Colton Idle

    Colton Idle

    11 months ago
    Yessssssss. Thank you so much @Francesc! That worked!
    @Francesc any tips on when to use intrinsic? Never used it before.
    Colton Idle

    Colton Idle

    11 months ago
    Thanks. Keep forgetting how awesome compose docs are. Lol
    Francesc

    Francesc

    11 months ago
    Albert beat me to it, but yes, that's it. I believe it's also part of one of the code labs.