What’s the proper way to create layout like this: ...
# compose
o
What’s the proper way to create layout like this: • Row with many items • Each item is measured according to its content • Row height is max height of all items • All items are laid out to fill this height, so their content can be properly aligned to bottom or center ?
j
cc @Adam Powell @George Mount
g
@Mihai Popa -- using intrinsics, right?
m
Right, use
.height(IntrinsicSize.Max)
on the Row and
.fillMaxHeight()
on the content
o
Thanks, it works perfectly. I just have to use
Modifier.height(IntrinsicSize.Max).then(modifier)
to allow user of a component to override default height.
c
@jim wouldn't this be impossible because you have no idea if item 3000 (wayyyy down the list) you wouldn't know if that item is taller because it has more content. So there's no way you'd be able to do this with LazyRow, you'd need to just use a Row?
j
Yeah, well, Lazy widgets are a whole other ball of wax. It is not surprising nor unexpected that this wouldn't work for Lazy widgets, for the reasons you mentioned, the data might not even be available yet.
Usually though, this is not an issue, since eager widgets are typically used when organizing the page, and Lazy widgets don't usually try to wrap their content.
c
Okay, so we're on the same page that this would have to be a Row and not LazyRow. Just wanted to make sure I'm not missing some kind of magical feature of lazyRow where it could actually measure everything somehow.