rememberStackState
Android
@Composable
public fun rememberStackState(@IntRange(from = 0) initialTopItem: Int = 0): StackState
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
| initialTopItem | The index of the item to show at the top of the stack initially. Must be non-negative. Defaults to 0. |