Start native apps faster with the Composables CLI ->
Interface

AdaptStrategy

Provides the information about how the associated pane should be adapted if not all panes can be displayed in the PaneAdaptedValue.Expanded state.

Source set: Common
sealed interface AdaptStrategy

Provides the information about how the associated pane should be adapted if not all panes can be displayed in the PaneAdaptedValue.Expanded state.

Functions

adapt

Source set: Common
@Deprecated(
        "This function is deprecated in favor of directly using the info carried by the " +
            "strategy instances to make adaptation decisions."
    )
    fun adapt(): PaneAdaptedValue

Override this function to provide the resulted adapted state.

Members

Reflow

Source set: Common
class Reflow(internal val reflowUnder: PaneScaffoldRole) : AdaptStrategy

Indicate the associated pane should be reflowed when certain conditions are met. With the default calculation functions calculateThreePaneScaffoldValue we provide, when it's a single pane layout, a pane with a reflow strategy will be adapted to either:

    supposed to be reflowed to is the current destination; or

  1. PaneAdaptedValue.Reflowed, when either the reflowed pane or the target pane it's
  2. PaneAdaptedValue.Hidden otherwise.

Note that if the current layout can have more than one horizontal partition, the pane will never be reflowed.

To provide custom adapt strategies, see the following sample:

Parameters

reflowUnder the pane that the reflowed pane will be put under; within the context of three pane scaffolds, the type of this parameter is supposed to be ThreePaneScaffoldRole.

Functions

toString

Source set: Common
override fun toString() = "AdaptStrategy[Reflow to $reflowUnder]"

equals

Source set: Common
override fun equals(other: Any?): Boolean

hashCode

Source set: Common
override fun hashCode(): Int

Levitate

Source set: Common
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:

    current destination; or

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

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

Source set: Common
override fun toString() = "AdaptStrategy[Levitate, alignment=$alignment, scrim=$scrim]"

equals

Source set: Common
override fun equals(other: Any?): Boolean

hashCode

Source set: Common
override fun hashCode(): Int

onlyIf

Source set: Common
@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

Source set: Common
@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.

Companion

Source set: Common
companion object

Properties

Hide

Source set: Common
val Hide: AdaptStrategy = Simple("Hide")

The default AdaptStrategy that suggests the layout to hide the associated pane when it has to be adapted, i.e., cannot be displayed in its PaneAdaptedValue.Expanded state.