Pavel Měsíček
11/23/2024, 7:14 PM.wrapContentSize()
, what am I doing wrong if Text is still taking up full width of the row? I would like to wrap background around visible text. Or does somebody have some workaround?
Column(modifier = Modifier.fillMaxWidth()) {
Row(
modifier = Modifier
.fillMaxWidth(0.7f)
.wrapContentSize()
.background(IntouchTheme.colors.brandGreen, shape = IntouchTheme.shapes.small),
) {
Text(
text = timeLine.content,
style = IntouchTheme.typography.regularL,
color = IntouchTheme.colors.fontPrimaryWhite,
softWrap = true,
modifier = Modifier
.padding(vertical = Grid.d2, horizontal = Grid.d3)
.wrapContentSize(),
)
}
}
Stylianos Gakis
11/23/2024, 7:23 PMwrapContentSize
does wrap if your component does not need all of the space you are giving it. In this case, your text does in fact need the entire width, since it's long enough to wrap to the next line.
What did you expect to see here btw as the result? Did you want the text to look more "balanced" where the two rows had more or less the same number of letters in them?ColdDev20
11/23/2024, 7:23 PMStylianos Gakis
11/23/2024, 7:24 PMStylianos Gakis
11/23/2024, 7:29 PMStylianos Gakis
11/23/2024, 7:50 PMPavel Měsíček
11/23/2024, 7:51 PM