ListScope
public sealed interface ListScope
Receiver scope which is used by VerticalList.
Summary
Public methods |
|
|---|---|
abstract void |
item(Adds a single item. |
abstract void |
items(Adds a |
Public methods
item
abstract void item(
Object key,
Object contentType,
@Composable @NonNull Function1<@NonNull ListItemScope, Unit> content
)
Adds a single item.
| Parameters | |
|---|---|
Object key |
a stable and unique key 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. |
Object contentType |
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. |
@Composable @NonNull Function1<@NonNull ListItemScope, Unit> content |
the content of the item |
items
abstract void items(
int count,
Function1<@NonNull Integer, @NonNull Object> key,
@NonNull Function1<@NonNull Integer, Object> contentType,
@Composable @NonNull Function2<@NonNull ListItemScope, @NonNull Integer, Unit> itemContent
)
Adds a count of items.
| Parameters | |
|---|---|
int count |
the items count |
Function1<@NonNull Integer, @NonNull Object> key |
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. |
@NonNull Function1<@NonNull Integer, Object> contentType |
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. |
@Composable @NonNull Function2<@NonNull ListItemScope, @NonNull Integer, Unit> itemContent |
the content displayed by a single item |