LazyGridItemInfo


Contains useful information about an individual item in lazy grids like LazyVerticalGrid.

Summary

Constants

const Int

Possible value for column, when they are unknown.

Cmn
const Int

Possible value for row, when they are unknown.

Cmn

Public properties

Int

The column occupied by the top start point of the item.

Cmn
Any?

The content type of the item which was passed to the item() or items() function.

Cmn
Int

The index of the item in the grid.

Cmn
Any

The key of the item which was passed to the item() or items() function.

Cmn
IntOffset

The offset of the item in pixels.

Cmn
Int

The row occupied by the top start point of the item.

Cmn
IntSize

The pixel size of the item.

Cmn
Int

The horizontal span of the item if it's in a LazyVerticalGrid or the vertical span if the item is in a LazyHorizontalGrid.

Cmn

Constants

UnknownColumn

const val UnknownColumnInt

Possible value for column, when they are unknown. This can happen when the item is visible while animating to exit the viewport.

UnknownRow

const val UnknownRowInt

Possible value for row, when they are unknown. This can happen when the item is visible while animating to exit the viewport.

Public properties

column

val columnInt

The column occupied by the top start point of the item. If this is unknown, for example while this item is animating to exit the viewport and is still visible, the value will be UnknownColumn.

contentType

val contentTypeAny?

The content type of the item which was passed to the item() or items() function.

index

val indexInt

The index of the item in the grid.

key

val keyAny

The key of the item which was passed to the item() or items() function.

offset

val offsetIntOffset

The offset of the item in pixels. It is relative to the top start of the lazy grid container.

row

val rowInt

The row occupied by the top start point of the item. If this is unknown, for example while this item is animating to exit the viewport and is still visible, the value will be UnknownRow.

size

val sizeIntSize

The pixel size of the item. Note that if you emit multiple layouts in the composable slot for the item then this size will be calculated as the max of their sizes.

span

val spanInt

The horizontal span of the item if it's in a LazyVerticalGrid or the vertical span if the item is in a LazyHorizontalGrid.

Note, LazyGridLayoutInfo.maxSpan can be used to get the maximum number of spans in a line, e.g., to check if the item is filling the whole line.