androidx.compose.material3.adaptive.layout
rememberPaneExpansionStateSince 1.1Experimental
Function · from org.jetbrains.compose.material3.adaptive:adaptive-layout:1.3.0
No hand-written docs yet.
Remembers and returns a PaneExpansionState associated to a given PaneExpansionStateKeyProvider.
With keyProviderExperimental
@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
keyProvider: PaneExpansionStateKeyProviderRequired
keyProvider: PaneExpansionStateKeyProviderRequiredthe provider of PaneExpansionStateKey
anchors: List<PaneExpansionAnchor>Optional
anchors: List<PaneExpansionAnchor>OptionalDefault: emptyList()
the anchor list of the returned PaneExpansionState
initialAnchoredIndex: IntOptional
initialAnchoredIndex: IntOptionalDefault: -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>Optional
anchoringAnimationSpec: FiniteAnimationSpec<Float>OptionalDefault: DefaultAnchoringAnimationSpec
the animation spec used to perform anchoring animation; by default it will be a spring motion.
flingBehavior: FlingBehaviorOptional
flingBehavior: FlingBehaviorOptionalDefault: ScrollableDefaults.flingBehavior()
the fling behavior used to handle flings; by default ScrollableDefaults.flingBehavior will be applied.
consumeDragDelta: ((delta: Float) -> Float)OptionalSince 1.2
consumeDragDelta: ((delta: Float) -> Float)OptionalSince 1.2Default: 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.
With keyExperimental
@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
key: PaneExpansionStateKeyOptional
key: PaneExpansionStateKeyOptionalDefault: PaneExpansionStateKey.Default
the key of PaneExpansionStateKey
consumeDragDelta: ((Float) -> Float)OptionalSince 1.2
consumeDragDelta: ((Float) -> Float)OptionalSince 1.2Default: 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.
Same as above: anchors, initialAnchoredIndex, anchoringAnimationSpec, flingBehavior.
Library docs
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.