Hi there, I'm struggling with a challenge.
I have two text fields in a row. One one the right side and one on the left side.
In best case the whole text of the right side is always shown and the text on the left side takes the rest of the space. If the right text is too long the left text should have a min width, so that at least some text with ellipses is shown. In my solution the right text takes the whole width and the left text is hidden. Even when I set the min width (I thought I set it). Any idea how to solve it?
Row(
horizontalArrangement = Arrangement.SpaceBetween
) {
Text(
modifier = Modifier
.weight(1f)
.widthIn(min = 200.dp),
textAlign = TextAlign.Start,
text = "Left side side side side side side side",
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
Text(
textAlign = TextAlign.End,
text = "Right right right right right right",
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
}
In best case I would be able to tell the right text to take only 60% but if the 60% is not required take less.
With
weight(0.6f)
it's a fixed space of 60% even if it's not required