androidx.xr.glimmer.list

Interfaces

GlimmerLazyListItemInfo

Contains useful information about an individual item in a GlimmerLazyColumn.

GlimmerLazyListItemScope

Receiver scope being used by the item content parameter of GlimmerLazyColumn.

GlimmerLazyListLayoutInfo

Information about the layout of the GlimmerLazyColumn.

GlimmerLazyListScope

Receiver scope which is used by GlimmerLazyColumn.

Classes

GlimmerLazyListState

A state object that can be hoisted to control and observe scrolling.

Objects

GlimmerLazyColumnDefaults

Contains the default values used by GlimmerLazyColumn.

Annotations

GlimmerLazyListScopeMarker

DSL marker used to distinguish between list layout scope and the item scope.

Composables

GlimmerLazyColumn

This is a scrolling list component that only composes and lays out the currently visible items.

rememberGlimmerLazyListState

Creates a GlimmerLazyListState that is remembered across compositions.

Top-level functions summary

Extension functions summary

inline Unit
<T : Any?> GlimmerLazyListScope.items(
    items: List<T>,
    noinline key: ((item) -> Any)?,
    noinline contentType: (item) -> Any?,
    crossinline itemContent: @Composable GlimmerLazyListItemScope.(item) -> Unit
)

Adds a list of items.

inline Unit
<T : Any?> GlimmerLazyListScope.itemsIndexed(
    items: List<T>,
    noinline key: ((index: Int, item) -> Any)?,
    crossinline contentType: (index: Int, item) -> Any?,
    crossinline itemContent: @Composable GlimmerLazyListItemScope.(index: Int, item) -> Unit
)

Adds a list of items where the content of an item is aware of its index.

Top-level functions

SnapLayoutInfoProvider

fun SnapLayoutInfoProvider(state: GlimmerLazyListState): SnapLayoutInfoProvider

Creates a default instance of SnapLayoutInfoProvider for the GlimmerLazyColumn.

Extension functions

GlimmerLazyListScope.items

inline fun <T : Any?> GlimmerLazyListScope.items(
    items: List<T>,
    noinline key: ((item) -> Any)? = null,
    noinline contentType: (item) -> Any? = { null },
    crossinline itemContent: @Composable GlimmerLazyListItemScope.(item) -> Unit
): Unit

Adds a list of items.

Parameters
items: List<T>

the data list

noinline key: ((item) -> Any)? = null

a factory of stable and unique keys representing the item. Using the same key for multiple items in the list is not allowed. Type of the key should be saveable via Bundle on Android. If null is passed the position in the list will represent the key. When you specify the key the scroll position will be maintained based on the key, which means if you add/remove items before the current visible item the item with the given key will be kept as the first visible one. This can be overridden by calling 'requestScrollToItem' on the 'GlimmerLazyListState'.

noinline contentType: (item) -> Any? = { null }

a factory of the content types for the item. The item compositions of the same type could be reused more efficiently. Note that null is a valid type and items of such type will be considered compatible.

crossinline itemContent: @Composable GlimmerLazyListItemScope.(item) -> Unit

the content displayed by a single item

GlimmerLazyListScope.itemsIndexed

inline fun <T : Any?> GlimmerLazyListScope.itemsIndexed(
    items: List<T>,
    noinline key: ((index: Int, item) -> Any)? = null,
    crossinline contentType: (index: Int, item) -> Any? = { _, _ -> null },
    crossinline itemContent: @Composable GlimmerLazyListItemScope.(index: Int, item) -> Unit
): Unit

Adds a list of items where the content of an item is aware of its index.

Parameters
items: List<T>

the data list

noinline key: ((index: Int, item) -> Any)? = null

a factory of stable and unique keys representing the item. Using the same key for multiple items in the list is not allowed. Type of the key should be saveable via Bundle on Android. If null is passed the position in the list will represent the key. When you specify the key the scroll position will be maintained based on the key, which means if you add/remove items before the current visible item the item with the given key will be kept as the first visible one.

crossinline contentType: (index: Int, item) -> Any? = { _, _ -> null }

a factory of the content types for the item. The item compositions of the same type could be reused more efficiently. Note that null is a valid type and items of such type will be considered compatible.

crossinline itemContent: @Composable GlimmerLazyListItemScope.(index: Int, item) -> Unit

the content displayed by a single item