StackStateKt

Added in 1.0.0-alpha01

public final class StackStateKt


Summary

Public methods

static final @NonNull StackState
@Composable
rememberStackState(@IntRange(from = 0) int initialTopItem)

Creates and remembers a StackState for a VerticalStack.

Public methods

rememberStackState

@Composable
public static final @NonNull StackState rememberStackState(@IntRange(from = 0) int initialTopItem)

Creates and remembers a StackState for a VerticalStack.

The returned StackState is remembered across compositions and can be used to control or observe the state of a VerticalStack. It's essential to pass this state to the state parameter of the corresponding VerticalStack composable.

Note: Properties of the state will only be correctly populated after the VerticalStack it is associated with has been composed for the first time.

Warning: A single StackState instance must not be shared across multiple VerticalStack composables.

Parameters
@IntRange(from = 0) int initialTopItem

The index of the item to show at the top of the stack initially. Must be non-negative. Defaults to 0.