Deprecated This method has been deprecated in favor of the one that accepts a consumeDragDelta.
rememberPaneExpansionState
@ExperimentalMaterial3AdaptiveApi
@Composable
fun rememberPaneExpansionState(
keyProvider: PaneExpansionStateKeyProvider,
anchors: List<PaneExpansionAnchor> = emptyList(),
initialAnchoredIndex: Int = -1,
anchoringAnimationSpec: FiniteAnimationSpec<Float> = DefaultAnchoringAnimationSpec,
flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(),
): 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 | the provider of PaneExpansionStateKey |
| anchors | the anchor list of the returned PaneExpansionState |
| initialAnchoredIndex | 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 | the animation spec used to perform anchoring animation; by default it will be a spring motion. |
| flingBehavior | the fling behavior used to handle flings; by default ScrollableDefaults.flingBehavior will be applied. |
Deprecated This method has been deprecated in favor of the one that accepts a consumeDragDelta.
rememberPaneExpansionState
@ExperimentalMaterial3AdaptiveApi
@Composable
fun rememberPaneExpansionState(
key: PaneExpansionStateKey = PaneExpansionStateKey.Default,
anchors: List<PaneExpansionAnchor> = emptyList(),
initialAnchoredIndex: Int = -1,
anchoringAnimationSpec: FiniteAnimationSpec<Float> = DefaultAnchoringAnimationSpec,
flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(),
): 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 | the key of PaneExpansionStateKey |
| anchors | the anchor list of the returned PaneExpansionState |
| initialAnchoredIndex | 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 | the animation spec used to perform anchoring animation; by default it will be a spring motion. |
| flingBehavior | the fling behavior used to handle flings; by default ScrollableDefaults.flingBehavior will be applied. |
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 | the provider of PaneExpansionStateKey |
| anchors | the anchor list of the returned PaneExpansionState |
| initialAnchoredIndex | 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 | the animation spec used to perform anchoring animation; by default it will be a spring motion. |
| flingBehavior | the fling behavior used to handle flings; by default ScrollableDefaults.flingBehavior will be applied. |
| consumeDragDelta | 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 // It's necessary to stabilize the lambda parameter
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 | the key of PaneExpansionStateKey |
| anchors | the anchor list of the returned PaneExpansionState |
| initialAnchoredIndex | 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 | the animation spec used to perform anchoring animation; by default it will be a spring motion. |
| flingBehavior | the fling behavior used to handle flings; by default ScrollableDefaults.flingBehavior will be applied. |
| consumeDragDelta | 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. |