Danish Ansari
03/21/2021, 2:25 PMRow
with some Text
and IconButton
but IconButton
is going outside the Row
, no idea why?
Row(
modifier = Modifier.fillMaxWidth().border(1.dp, Color.Red).padding(8.dp),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = <http://Alignment.Top|Alignment.Top>,
) {
VeryBigText(modifier = Modifier.border(1.dp, Color.Yellow))
IconButton( onClick = {}, modifier = Modifier.requiredSize(24.dp).border(1.dp, Color.Green)) {
Icon(
Icons.Default.Close,
contentDescription = "Dismiss",
modifier = Modifier.requiredSize(16.dp)
)
}
}
What am I doing wrong?Dominaezzz
03/21/2021, 2:50 PMVeryBigText
is doing something naughty like Modifier.fillMaxWidth()
.Dirk Hoffmann
03/21/2021, 2:55 PM.fillMaxWidth()
also, and that is eating up all the Row's widthAdam Powell
03/21/2021, 3:18 PMModifier.weight(1f)
on the VeryBigText
to tell the row to measure it last after all of the other children have been measured and take up the remaining space.Danish Ansari
03/21/2021, 4:15 PMfillMaxWidth()
on VeryBigText
@Adam Powell setting weight(1f)
solved the problem, up until now I used to think that weight(1f)
is equivalent to fillMaxWidth()
Thanks for clearing the doubt