StaggeredGridCells.FixedSize


Defines a grid with as many rows or columns as possible on the condition that every cell takes exactly size space. The remaining space will be arranged through LazyStaggeredGrid arrangements on corresponding axis. If size is larger than container size, the cell will be size to match the container.

For example, for the vertical LazyVerticalStaggeredGrid FixedSize(20.dp) would mean that there will be as many columns as possible and every column will be exactly 20.dp. If the screen is 88.dp wide tne there will be 4 columns 20.dp each with remaining 8.dp distributed through Arrangement.Horizontal.

Summary

Public constructors

FixedSize(size: Dp)
Cmn

Public functions

open IntArray
Density.calculateCrossAxisCellSizes(availableSize: Int, spacing: Int)

Calculates the number of cells and their cross axis size based on availableSize and spacing.

Cmn
open operator Boolean
equals(other: Any?)
Cmn
open Int
Cmn

Public constructors

FixedSize

FixedSize(size: Dp)

Public functions

calculateCrossAxisCellSizes

open fun Density.calculateCrossAxisCellSizes(availableSize: Int, spacing: Int): IntArray

Calculates the number of cells and their cross axis size based on availableSize and spacing.

For example, in vertical grids, spacing is passed from the grid's Arrangement.Horizontal. The Arrangement.Horizontal will also be used to arrange items in a row if the grid is wider than the calculated sum of columns.

Note that the calculated cross axis sizes will be considered in an RTL-aware manner -- if the staggered grid is vertical and the layout direction is RTL, the first width in the returned list will correspond to the rightmost column.

Parameters
availableSize: Int

available size on cross axis, e.g. width of LazyVerticalStaggeredGrid.

spacing: Int

cross axis spacing, e.g. horizontal spacing for LazyVerticalStaggeredGrid. The spacing is passed from the corresponding Arrangement param of the lazy grid.

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int