androidx.compose.material3.adaptive.layout

PaneExpansionStateSince 1.1

Class · from org.jetbrains.compose.material3.adaptive:adaptive-layout:1.3.0

No hand-written docs yet.

This class manages the pane expansion state for pane scaffolds. By providing and modifying an instance of this class, you can specify the expanded panes' expansion width or proportion when pane scaffold is displaying a dual-pane layout.

class PaneExpansionState

How to get one

Ready-made values and functions that return it

Used by

Parameters that take a PaneExpansionState.

Properties

currentAnchor

val currentAnchor

The current anchor that pane expansion has been settled or is settling to. Note that this field might be null if: 1. No anchors have been set to the state. 2. Pane expansion is set directly via setFirstPaneWidth or set setFirstPaneProportion. 3. Pane expansion is in its initial state without an initial anchor provided.

Unspecified

const val Unspecified

The constant value used to denote the pane expansion is not specified.

Functions

isUnspecified

fun isUnspecified(): Boolean

Returns true if none of firstPaneWidth or firstPaneProportion has been set.

setFirstPaneWidth

fun setFirstPaneWidth(firstPaneWidth: Int)

Set the width of the first expanded pane in the layout. When the set value gets applied, it will be coerced within the range of [0, the full displayable width of the layout].

setFirstPaneProportion

fun setFirstPaneProportion(firstPaneProportion: Float)

Set the proportion of the first expanded pane in the layout. The set value needs to be within the range of [0f, 1f], otherwise the setter throws.

animateTo

fun animateTo(
    anchor: PaneExpansionAnchor,
    initialVelocity: Float = 0F,
)

Animate the pane expansion to the given PaneExpansionAnchor. Note that the given anchor must be one of the provided anchor when creating the state with rememberPaneExpansionState; otherwise the function throws.

clear

fun clear()

Clears any previously set firstPaneWidth or firstPaneProportion, as well as the user dragging result.

Library docs

This class manages the pane expansion state for pane scaffolds. By providing and modifying an instance of this class, you can specify the expanded panes' expansion width or proportion when pane scaffold is displaying a dual-pane layout.

This class also serves as the DraggableState of pane expansion handle. When a handle implementation is provided to the associated pane scaffold, the scaffold will use PaneExpansionState to store and manage dragging and anchoring of the handle, and thus the pane expansion state.