Hi, I have a LazyVerticalGrid of images, and I want to know the size of the cells so I know what size images to fetch. How can I get the size of an individual cell? Because the size is dynamically determined by the number of columns, spacing, and contentPadding, I don't know the size ahead of time.
09/16/2022, 11:48 PM
Do you know the number of columns?
09/16/2022, 11:55 PM
The number of columns can change but I know the number of columns
09/16/2022, 11:57 PM
If you have the device width and the number of columns, is that good enough to get you close to the size of your cells?
09/17/2022, 12:00 AM
Yeah but I want the exact size, and the width of the LazyVerticalGrid could be less than the device width.
09/17/2022, 7:06 AM
You can use Modifier extension function onGloballyPositioned on LazyVerticalGrid's Modifier and you have LayoutCoordinate in its lamda you can get LayoutCoordinate.IntSize the size of your verticalGrid and also you can get LayoutCoordinate.parentLayoutCoordinate, hope it may help you.