class Levitate(
internal val alignment: Alignment = Alignment.Center,
internal val scrim: (@Composable () -> Unit)? = null,
internal val dragToResizeState: DragToResizeState? = null,
) : AdaptStrategy
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:
- PaneAdaptedValue.Levitated with specified
alignment, when the levitated pane is the PaneAdaptedValue.Hiddenotherwise.
current destination; or
Parameters
| alignment | the alignment of the associated pane when it's levitated, relatively to the pane scaffold. |
| scrim | the scrim to show when the pane is levitated to block user interaction with the underlying layout and emphasize the levitated pane; by default it will be null and no scrim will show; to display a scrim, we recommend to use LevitatedPaneScrim as a default implementation. |
| dragToResizeState | the optional state to enable the levitated pane to be resizable by dragging; it will be used to store and control current dragging; see rememberDragToResizeState for more details about how to implement the drag-to-resize behavior. |
Functions
toString
override fun toString() = "AdaptStrategy[Levitate, alignment=$alignment, scrim=$scrim]"
equals
override fun equals(other: Any?): Boolean
hashCode
override fun hashCode(): Int
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.