Travis Griggs
04/13/2023, 6:06 PMSpacer(
modifier = Modifier
.width(1.dp)
.height(IntrinsicSize.Max)
.background(MaterialTheme.colorScheme.outline)
)
it doesn't show up at all.
If I change it to
Spacer(
modifier = Modifier
.width(1.dp)
.fillMaxHeight()
.background(MaterialTheme.colorScheme.outline)
)
Then it shows up, but makes the row be as tall as the screen nearly. How does one achieve the middle ground? I want it to vertically fill the whole row's height, but I don't want it to contribute to how tall the row is, other labels and buttons in the row are doing that already?
I have a hunch it's some variation of .layout modifier. But it's not clear how the child node communicates "you can measure my height as big as you're going to be, but really no preference here"ephemient
04/13/2023, 6:09 PMPablichjenkov
04/13/2023, 6:12 PMTravis Griggs
04/13/2023, 6:36 PMmatchParentSize
in BoxScope, but that's the only match* thing I seePablichjenkov
04/13/2023, 7:24 PMTravis Griggs
04/13/2023, 8:16 PMPablichjenkov
04/13/2023, 8:58 PMephemient
04/13/2023, 8:59 PMRow { Modifier.matchParentHeight() }
yourself, you'll find that it's doable - if you don't support Modifier.weight()
. if you do, then measurement can't be done single-passPablichjenkov
04/13/2023, 9:07 PMephemient
04/13/2023, 9:08 PMPablichjenkov
04/13/2023, 9:30 PMLoney Chou
04/13/2023, 10:26 PMweight
requires all the other children been measured, and matchParentCrossAxisSize
also requires that, but they're on the different axes, so if there were a child with weight
and another with matchParentCrossAxisSize
, it's a deadlock.ephemient
04/13/2023, 10:36 PMRow { Modifier.matchParentHeight() }
, but not Modifier.weight()
. I think you'd need separate scope types, and it would be kind of difficult to disambiguate by overload so you'd want separate layout names as well, but haven't thought through itLoney Chou
04/13/2023, 10:37 PMPablichjenkov
04/13/2023, 11:16 PMephemient
04/13/2023, 11:17 PMRow { Modifier.matchParentHeight() }
,
Row {
Box(Modifier.weight(1f))
Box(Modifier.matchParentHeight())
}
could not be implemented in one layout passPablichjenkov
04/13/2023, 11:18 PMephemient
04/13/2023, 11:23 PMPablichjenkov
04/13/2023, 11:24 PM