androidx.compose.material3.adaptive.layout
rememberDragToResizeStateSince 1.3Experimental
Function · from org.jetbrains.compose.material3.adaptive:adaptive-layout:1.3.0
No hand-written docs yet.
Creates and remembers a DragToResizeState instance.
ParametersExperimental
@Composable
fun rememberDragToResizeState(
dockedEdge: DockedEdge,
minSize: Dp = Dp.Unspecified,
maxSize: Dp = Dp.Unspecified,
): DragToResizeState
dockedEdge: DockedEdgeRequired
dockedEdge: DockedEdgeRequiredThe edge to which the element is docked. This determines the orientation of the resizing operation (horizontal or vertical) and the direction of the size change when dragging.
minSize: DpOptional
minSize: DpOptionalDefault: Dp.Unspecified
The minimum allowed size for the resizable element, as a Dp. Defaults to Dp.Unspecified, which instructs scaffold to use its default setting.
maxSize: DpOptional
maxSize: DpOptionalDefault: Dp.Unspecified
The maximum allowed size for the resizable element, as a Dp. Defaults to Dp.Unspecified. Note that the dragged size cannot be larger than the scaffold's size, even if the max size set here is larger than the scaffold's size.
Library docs
Creates and remembers a DragToResizeState instance.
This function creates a state object that tracks and controls the resizing behavior of a
composable element via dragging. The state is saved and restored across recompositions and
configuration changes using rememberSaveable.
To support the drag-to-resize behavior, provide DragToResizeState objects when creating
AdaptStrategy.Levitate instances and provide a drag handle to the AnimatedPane composable,
which will show the drag handle and associate it with the state object when it's levitated, so
the pane will act like a modal sheet, and users can drag or click the drag handle to resize the
pane.
Note that with the default implementation, clicking the drag handle will make the associated pane
go through three states: collapsed, partially expanded, and expanded. When in the expanded state,
the pane will be displayed in its maximum possible size, bounded by the scaffold's size and the
maximum size set via rememberDragToResizeState. When in the collapsed state, the associated
pane will be displayed in its minimum size set via rememberDragToResizeState. And in the
partially expanded size, the pane will be displayed in its default size or the size set by user
with dragging.