ExpandableViewState

class ExpandableViewState(initialWidth: Dp, initialHeight: Dp, initialExpanded: Boolean = false, context: Context, density: Density)

State holder for the expandable XR scene component.

The expansion/collapse animation is driven by repeatedly calling SpatialContainerUtils.resizeCurrentWindowContainer with animated width values. The Compose content itself is NOT animated; it simply reacts to the window container size changes that the system feeds back through measure/layout.

Constructors

Link copied to clipboard
constructor(initialWidth: Dp, initialHeight: Dp, initialExpanded: Boolean = false, context: Context, density: Density)

Properties

Link copied to clipboard

The current real-time height of the window container (tracks configuration changes).

Link copied to clipboard
var currentWidth: Dp

The current real-time width of the window container (tracks configuration changes).

Link copied to clipboard
var isExpanded: Boolean

The current expansion state. Flips immediately when expand/collapse is invoked.

Functions

Link copied to clipboard
fun collapse()

Collapses the window by animating SpatialContainerUtils.resizeCurrentWindowContainer's width from the current actual position back to collapsedBaseWidthPx.

Link copied to clipboard
fun expand()

Expands the window by animating SpatialContainerUtils.resizeCurrentWindowContainer's width from the current actual position to collapsedBaseWidthPx + expandedPanelWidth.

Link copied to clipboard
fun toggle()

Toggles the current expansion state.