Composable Function

rememberStackState

Creates and remembers a StackState for a VerticalStack.

rememberStackState

Source set: 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.
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: