androidx.compose.material3.adaptive.layout

LevitateSince 1.2

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

No hand-written docs yet.

Indicate the associated pane should be levitated when it's the current destination.

class Levitate(
    alignment: Alignment = Alignment.Center,
    scrim: (@Composable () -> Unit)? = null,
    dragToResizeState: DragToResizeState? = null,
) : AdaptStrategy

Is a

How to get one

Create it

Functions

onlyIf

@Composable
fun onlyIf(condition: Boolean): AdaptStrategy

This is a convenient function to only levitate the associated pane when the provided condition is met. If the condition is not met, the pane will be expanded instead, if there's enough room; otherwise it will be hidden.

onlyIfSinglePane

@Composable
fun onlyIfSinglePane(scaffoldDirective: PaneScaffoldDirective): AdaptStrategy

This is a convenient function to only levitate the associated pane when it's a single-pane layout. On multi-pane layouts, the pane will be expanded instead, if it's one of the recent destinations.

Library docs

Indicate the associated pane should be levitated when it's the current destination.

A levitated pane will be rendered above other panes in the pane scaffold like a pop-up or a sheet (for example, as a bottom sheet or a side sheet.) A scrim can be provided to block interaction with the underlying panes.

With the default calculateThreePaneScaffoldValue we provide, a pane with a levitate strategy will be adapted to either:

  1. PaneAdaptedValue.Levitated with specified alignment, when the levitated pane is the current destination; or
  2. PaneAdaptedValue.Hidden otherwise.