TransformingLazyColumnScope

@TransformingLazyColumnScopeMarker
sealed interface TransformingLazyColumnScope


Receiver scope which is used by TransformingLazyColumn.

Summary

Public functions

Unit
item(key: Any?, contentType: Any?, content: @Composable TransformingLazyColumnItemScope.() -> Unit)

Adds a single item.

Unit
items(
    count: Int,
    key: ((index: Int) -> Any)?,
    contentType: (index: Int) -> Any,
    content: @Composable TransformingLazyColumnItemScope.(index: Int) -> Unit
)

Adds count items.

Extension functions

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

Adds a list of items.

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

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

Public functions

item

Added in 1.5.0-alpha06
fun item(key: Any? = null, contentType: Any? = null, content: @Composable TransformingLazyColumnItemScope.() -> Unit): Unit

Adds a single item.

Parameters
key: Any? = null

A stable and unique key representing the item. Using the same key for multiple items in the TransformingLazyColumn is not allowed. Type of the key should be saveable via Bundle on Android. If null is passed the position in the TransformingLazyColumn 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.

contentType: Any? = null

The type of the content of this 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.

content: @Composable TransformingLazyColumnItemScope.() -> Unit

The content of the item.

items

Added in 1.5.0-alpha06
fun items(
    count: Int,
    key: ((index: Int) -> Any)? = null,
    contentType: (index: Int) -> Any = { null },
    content: @Composable TransformingLazyColumnItemScope.(index: Int) -> Unit
): Unit

Adds count items.

Parameters
count: Int

The number of items to add to the TransformingLazyColumn.

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

A factory of stable and unique keys representing the item. Using the same key for multiple items in the TransformingLazyColumn is not allowed.

contentType: (index: Int) -> 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.

content: @Composable TransformingLazyColumnItemScope.(index: Int) -> Unit

The content displayed by a single item.

Extension functions

inline fun <T : Any?> TransformingLazyColumnScope.items(
    items: List<T>,
    noinline key: ((item) -> Any)? = null,
    noinline contentType: (item) -> Any = { null },
    crossinline itemContent: @Composable TransformingLazyColumnItemScope.(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 TransformingLazyColumn is not allowed. Type of the key should be saveable via Bundle on Android. If null is passed the position in the TransformingLazyColumn 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.

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 TransformingLazyColumnItemScope.(item) -> Unit

the content displayed by a single item.

inline fun <T : Any?> TransformingLazyColumnScope.itemsIndexed(
    items: List<T>,
    noinline key: ((index: Int, item) -> Any)? = null,
    crossinline contentType: (index: Int, item) -> Any = { _, _ -> null },
    crossinline itemContent: @Composable TransformingLazyColumnItemScope.(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 TransformingLazyColumn 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 TransformingLazyColumnItemScope.(index: Int, item) -> Unit

the content displayed by a single item