rememberPaneExpansionState

Functions summary

PaneExpansionState
@ExperimentalMaterial3AdaptiveApi
@Composable
rememberPaneExpansionState(
    key: PaneExpansionStateKey,
    anchors: List<PaneExpansionAnchor>,
    initialAnchoredIndex: Int,
    anchoringAnimationSpec: FiniteAnimationSpec<Float>,
    flingBehavior: FlingBehavior,
    consumeDragDelta: (Float) -> Float
)

Remembers and returns a PaneExpansionState associated to a given PaneExpansionStateKey.

Cmn
PaneExpansionState
@ExperimentalMaterial3AdaptiveApi
@Composable
rememberPaneExpansionState(
    keyProvider: PaneExpansionStateKeyProvider,
    anchors: List<PaneExpansionAnchor>,
    initialAnchoredIndex: Int,
    anchoringAnimationSpec: FiniteAnimationSpec<Float>,
    flingBehavior: FlingBehavior,
    consumeDragDelta: (delta: Float) -> Float
)

Remembers and returns a PaneExpansionState associated to a given PaneExpansionStateKeyProvider.

Cmn

Functions

rememberPaneExpansionState

@ExperimentalMaterial3AdaptiveApi
@Composable
fun rememberPaneExpansionState(
    key: PaneExpansionStateKey = PaneExpansionStateKey.Default,
    anchors: List<PaneExpansionAnchor> = emptyList(),
    initialAnchoredIndex: Int = -1,
    anchoringAnimationSpec: FiniteAnimationSpec<Float> = DefaultAnchoringAnimationSpec,
    flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(),
    consumeDragDelta: (Float) -> Float = PaneExpansionState.noOpConsumeDragDelta
): PaneExpansionState

Remembers and returns a PaneExpansionState associated to a given PaneExpansionStateKey.

Note that the remembered PaneExpansionState with all keys that have been used will be persistent through the associated pane scaffold's lifecycles.

Parameters
key: PaneExpansionStateKey = PaneExpansionStateKey.Default

the key of PaneExpansionStateKey

anchors: List<PaneExpansionAnchor> = emptyList()

the anchor list of the returned PaneExpansionState

initialAnchoredIndex: Int = -1

the index of the anchor that is supposed to be used during the initial layout of the associated scaffold; it has to be a valid index of the provided anchors otherwise the function throws; by default the value will be -1 and no initial anchor will be used.

anchoringAnimationSpec: FiniteAnimationSpec<Float> = DefaultAnchoringAnimationSpec

the animation spec used to perform anchoring animation; by default it will be a spring motion.

flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior()

the fling behavior used to handle flings; by default ScrollableDefaults.flingBehavior will be applied.

consumeDragDelta: (Float) -> Float = PaneExpansionState.noOpConsumeDragDelta

the callback that will be called before the drag starts to change the pane sizes; the input of the lambda will be the raw delta by user dragging, and it should returns the remaining delta after the consumption by the callback; this can be used to implement custom behavior like nested scrolling or combining pane expansion with other element expansion behavior like navigation rails.

rememberPaneExpansionState

@ExperimentalMaterial3AdaptiveApi
@Composable
fun rememberPaneExpansionState(
    keyProvider: PaneExpansionStateKeyProvider,
    anchors: List<PaneExpansionAnchor> = emptyList(),
    initialAnchoredIndex: Int = -1,
    anchoringAnimationSpec: FiniteAnimationSpec<Float> = DefaultAnchoringAnimationSpec,
    flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(),
    consumeDragDelta: (delta: Float) -> Float = PaneExpansionState.noOpConsumeDragDelta
): PaneExpansionState

Remembers and returns a PaneExpansionState associated to a given PaneExpansionStateKeyProvider.

Note that the remembered PaneExpansionState with all keys that have been used will be persistent through the associated pane scaffold's lifecycles.

Parameters
keyProvider: PaneExpansionStateKeyProvider

the provider of PaneExpansionStateKey

anchors: List<PaneExpansionAnchor> = emptyList()

the anchor list of the returned PaneExpansionState

initialAnchoredIndex: Int = -1

the index of the anchor that is supposed to be used during the initial layout of the associated scaffold; it has to be a valid index of the provided anchors otherwise the function throws; by default the value will be -1 and no initial anchor will be used.

anchoringAnimationSpec: FiniteAnimationSpec<Float> = DefaultAnchoringAnimationSpec

the animation spec used to perform anchoring animation; by default it will be a spring motion.

flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior()

the fling behavior used to handle flings; by default ScrollableDefaults.flingBehavior will be applied.

consumeDragDelta: (delta: Float) -> Float = PaneExpansionState.noOpConsumeDragDelta

the callback that will be called before the drag starts to change the pane sizes; the input of the lambda will be the raw delta by user dragging, and it should returns the remaining delta after the consumption by the callback; this can be used to implement custom behavior like nested scrolling or combining pane expansion with other element expansion behavior like navigation rails.