Marcin Środa

    Marcin Środa

    1 year ago
    Hey, trying to place an item after ellipsized text. When text is not ellipsized it works fine, but when overflow happens, the icon is not displayed. Any ideas? 🧵
    Row {
            Text(
                text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
                maxLines = 1,
                overflow = TextOverflow.Ellipsis,
            )
            Icon(
                imageVector = Icons.Filled.ArrowRight,
                contentDescription = "Icon",
            )
        }
    Adam Powell

    Adam Powell

    1 year ago
    Row measures its children in order by default. If the text is ellipsizing it's because you're out of horizontal space and there's none left for the icon either. Try
    Modifier.weight(1f, false)
    on the
    Text
    . That will request the
    Text
    be measured after unweighted children.
    Marcin Środa

    Marcin Środa

    1 year ago
    Thanks! 🙂