curtjrees
03/14/2021, 1:54 PMBoxWithConstraints
Feels I might need to use a Layout/SubcomposeLayout instead, but I’m not sure
I’m using the maxWidth and maxHeight to calculate sizes and positions for items on a “grid”curtjrees
03/14/2021, 1:54 PMcurtjrees
03/14/2021, 1:55 PMAdam Powell
03/14/2021, 2:33 PMLayout for this. Specifically I would use parent data to carry the coordinates in the grid and define a custom modifier function to declare the coordinates of each child within this layout.curtjrees
03/14/2021, 2:54 PMLayout ?
It’s still one of those mysterious Compose concepts for me currentlycurtjrees
03/14/2021, 3:55 PMBoxWithConstraints though?
Since it feels very similarAdam Powell
03/14/2021, 4:05 PMPositionData rather than individual elements of it, so you can obtain it from the measurable once instead of fetching/casting it for every field, and if you want to be industrial strength about it you can define a receiver scope interface that offers an appropriate modifier factory functionAdam Powell
03/14/2021, 4:08 PMBoxWithConstraints forces going back to the full composition => measure => layout => draw sequence for the children when only measure => layout => draw is needed. BoxWithConstraints is only needed if you want to change what you actually compose based on available space, such as switching between different layouts for phone vs. tablet or desktop screen sizes.Adam Powell
03/14/2021, 4:09 PMBoxWithConstraints when Layout can accomplish what you want will always be less efficient since there's more work involved.curtjrees
03/14/2021, 4:11 PM