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
jim
07/20/2021, 10:41 PM
cc @Adam Powell@George Mount
g
George Mount
07/20/2021, 11:12 PM
@Mihai Popa -- using intrinsics, right?
m
Mihai Popa
07/21/2021, 7:26 AM
Right, use
.height(IntrinsicSize.Max)
on the Row and
.fillMaxHeight()
on the content
o
orangy
07/21/2021, 11:34 AM
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
Colton Idle
07/21/2021, 3:21 PM
@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
jim
07/21/2021, 3:27 PM
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.
jim
07/21/2021, 3:29 PM
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
Colton Idle
07/21/2021, 4:09 PM
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.