androidx.compose.material3.adaptive.layout

Interfaces

AdaptStrategy

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

Cmn
AnimatedPaneOverride

Interface that allows libraries to override the behavior of AnimatedPane.

Cmn
AnimatedPaneScope

Scope for the content of AnimatedPane.

Cmn
ExtendedPaneScaffoldPaneScope

Extended scope for the panes of pane scaffolds.

Cmn
ExtendedPaneScaffoldScope

Extended scope for pane scaffolds.

Cmn
PaneAdaptedValue

The adapted state of a pane.

Cmn
PaneExpansionStateKey

Interface that serves as keys to remember and retrieve PaneExpansionState with rememberPaneExpansionState.

Cmn
PaneExpansionStateKeyProvider

Interface that provides PaneExpansionStateKey to remember and retrieve PaneExpansionState with rememberPaneExpansionState.

Cmn
PaneMargins

Represents the margins of a pane within a pane scaffold.

Cmn
PaneMotion

Interface to specify a custom pane enter/exit motion when a pane's visibility changes.

Cmn
PaneScaffoldHorizontalOrder

Represents the horizontal order of panes in a pane scaffold.

Cmn
PaneScaffoldMotionDataProvider

Scope for performing pane motions within a pane scaffold.

Cmn
PaneScaffoldPaneScope

The pane scope of the current pane under the scope, which provides the pane relevant info like its role and PaneMotion.

Cmn
PaneScaffoldParentData

The parent data passed to pane scaffolds by their contents like panes and drag handles.

Cmn
PaneScaffoldRole

The interface that represents roles of panes in pane scaffold implementations.

Cmn
PaneScaffoldScope

The base scope of pane scaffolds, which provides scoped functions that supported by pane scaffolds.

Cmn
PaneScaffoldTransitionScope

The transition scope of pane scaffold implementations, which provides the current transition info of the associated pane scaffold.

Cmn
PaneScaffoldValue

Interface to provide adapted value of panes.

Cmn
ThreePaneScaffoldOverride

Interface that allows libraries to override the behavior of ThreePaneScaffold.

Cmn
ThreePaneScaffoldPaneScope

Scope for the panes of ThreePaneScaffold.

Cmn
ThreePaneScaffoldScope

Scope for the panes of ThreePaneScaffold.

Cmn

Classes

AdaptStrategy.Levitate

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

Cmn
AdaptStrategy.Reflow

Indicate the associated pane should be reflowed when certain conditions are met.

Cmn
AnimatedPaneOverrideScope

Parameters available to AnimatedPane.

Cmn
DragToResizeState

A state object that can be used to control the resizing behavior of a pane.

Cmn
HingePolicy

Policies that indicate how hinges are supposed to be addressed in an adaptive layout.

Cmn
MutableThreePaneScaffoldState

The seekable state of a three pane scaffold.

Cmn
PaneAdaptedValue.Levitated

Indicates that the associated pane should be levitated with the specified alignment.

Cmn
PaneAdaptedValue.Reflowed

Indicates that the associated pane should be reflowed to its reflowUnder, i.e., it will be displayed under the target pane.

Cmn
PaneExpansionAnchor

The implementations of this interface represent different types of anchors of pane expansion dragging.

Cmn
PaneExpansionAnchor.Offset

PaneExpansionAnchor implementation that specifies the anchor position based on the offset in Dp.

Cmn
PaneExpansionAnchor.Offset.Direction

Represents the direction from where the offset will be calculated.

Cmn
PaneExpansionAnchor.Proportion

PaneExpansionAnchor implementation that specifies the anchor position in the proportion of the total size of the layout at the start side of the anchor.

Cmn
PaneExpansionState

This class manages the pane expansion state for pane scaffolds.

Cmn
PaneMotion.Type

Indicates the current type of pane motion, like if the pane is entering or exiting, or is kept showing or hidden.

Cmn
PaneMotionData

A class to collect motion-relevant data of a specific pane.

Cmn
PaneScaffoldDirective

Top-level directives about how a pane scaffold should be arranged and spaced, like how many partitions the layout can be split into and what should be the gutter size.

Cmn
ThreePaneMotion

The class that provides motion settings for three pane scaffolds like ListDetailPaneScaffold and SupportingPaneScaffold.

Cmn
ThreePaneScaffoldAdaptStrategies

The adaptation specs of ThreePaneScaffold.

Cmn
ThreePaneScaffoldDestinationItem

An item representing a navigation destination in a ThreePaneScaffold.

Cmn
ThreePaneScaffoldHorizontalOrder

Represents the horizontal order of panes in a ThreePaneScaffold from start to end.

Cmn
ThreePaneScaffoldOverrideScope

Parameters available to ThreePaneScaffold.

Cmn
ThreePaneScaffoldState

A read-only state of a three pane scaffold.

Cmn
ThreePaneScaffoldValue

The adapted value of ThreePaneScaffold.

Cmn

Objects

LevitatedPaneScrimDefaults

The objet to provide default values of LevitatedPaneScrim.

Cmn
ListDetailPaneScaffoldDefaults

Provides default values of ListDetailPaneScaffold.

Cmn
ListDetailPaneScaffoldRole

The set of the available pane roles of ListDetailPaneScaffold.

Cmn
PaneMotionDefaults

The default settings of pane motions.

Cmn
SupportingPaneScaffoldDefaults

Provides default values of SupportingPaneScaffold.

Cmn
SupportingPaneScaffoldRole

The set of the available pane roles of SupportingPaneScaffold.

Cmn

Enums

DockedEdge

Represents the edge of a resizable pane that is docked, i.e. the edge that will stay in the same position during resizing.

Cmn
ThreePaneScaffoldRole

The set of the available pane roles of ThreePaneScaffold.

Cmn

Composables

AnimatedPane

The root composable of pane contents in a ThreePaneScaffold that supports default motions during pane switching.

Cmn
LevitatedPaneScrim

The default scrim implementation shown with a levitated pane to block the user interaction from the underlying layout.

Cmn
ListDetailPaneScaffold

A three pane layout that follows the Material guidelines, displaying the provided panes in a canonical list-detail layout.

Cmn
SupportingPaneScaffold

A three pane layout that follows the Material guidelines, displaying the provided panes in a canonical supporting pane layout.

Cmn
defaultDragHandleSemantics

This function sets up the default semantics of pane expansion drag handles with the given PaneExpansionState.

Cmn
rememberDragToResizeState

Creates and remembers a DragToResizeState instance.

Cmn
rememberPaneExpansionState

Remembers and returns a PaneExpansionState associated to a given PaneExpansionStateKey.

Cmn

Top-level functions summary

PaneScaffoldDirective
@ExperimentalMaterial3AdaptiveApi
calculatePaneScaffoldDirective(
    windowAdaptiveInfo: WindowAdaptiveInfo,
    verticalHingePolicy: HingePolicy
)

Calculates the recommended PaneScaffoldDirective from a given WindowAdaptiveInfo.

Cmn
PaneScaffoldDirective

Calculates the recommended PaneScaffoldDirective from a given WindowAdaptiveInfo.

Cmn
ThreePaneScaffoldValue
@ExperimentalMaterial3AdaptiveApi
calculateThreePaneScaffoldValue(
    maxHorizontalPartitions: Int,
    adaptStrategies: ThreePaneScaffoldAdaptStrategies,
    currentDestination: ThreePaneScaffoldDestinationItem<*>?,
    maxVerticalPartitions: Int
)

Calculates the current adapted value of ThreePaneScaffold according to the given maxHorizontalPartitions, adaptStrategies and currentDestination.

Cmn
ThreePaneScaffoldValue
@ExperimentalMaterial3AdaptiveApi
calculateThreePaneScaffoldValue(
    maxHorizontalPartitions: Int,
    adaptStrategies: ThreePaneScaffoldAdaptStrategies,
    destinationHistory: List<ThreePaneScaffoldDestinationItem<*>>,
    maxVerticalPartitions: Int
)

Calculates the current adapted value of ThreePaneScaffold according to the given maxHorizontalPartitions, adaptStrategies and destinationHistory.

Cmn

Extension functions summary

EnterTransition

Calculates the default EnterTransition of the pane associated to the given role when it's showing.

Cmn
ExitTransition

Calculates the default ExitTransition of the pane associated to the given role when it's hiding.

Cmn
inline Unit

Perform actions on each PaneMotionData, in the left-to-right order of the panes in the scaffold.

Cmn
inline Unit

Perform actions on each PaneMotionData, in the right-to-left order of the panes in the scaffold.

Cmn

Top-level properties summary

Top-level functions

calculatePaneScaffoldDirective

@ExperimentalMaterial3AdaptiveApi
fun calculatePaneScaffoldDirective(
    windowAdaptiveInfo: WindowAdaptiveInfo,
    verticalHingePolicy: HingePolicy = HingePolicy.AvoidSeparating
): PaneScaffoldDirective

Calculates the recommended PaneScaffoldDirective from a given WindowAdaptiveInfo. Use this method with currentWindowAdaptiveInfoV2 to acquire Material-recommended adaptive layout settings of the current activity window.

See more details on the Material design guideline site (https://m3.material.io/foundations/layout/applying-layout/window-size-classes).

Parameters
windowAdaptiveInfo: WindowAdaptiveInfo

WindowAdaptiveInfo that collects useful information in making layout adaptation decisions like androidx.window.core.layout.WindowSizeClass.

verticalHingePolicy: HingePolicy = HingePolicy.AvoidSeparating

HingePolicy that decides how layouts are supposed to address vertical hinges.

Returns
PaneScaffoldDirective

an PaneScaffoldDirective to be used to decide adaptive layout states.

calculatePaneScaffoldDirectiveWithTwoPanesOnMediumWidth

@ExperimentalMaterial3AdaptiveApi
fun calculatePaneScaffoldDirectiveWithTwoPanesOnMediumWidth(
    windowAdaptiveInfo: WindowAdaptiveInfo,
    verticalHingePolicy: HingePolicy = HingePolicy.AvoidSeparating
): PaneScaffoldDirective

Calculates the recommended PaneScaffoldDirective from a given WindowAdaptiveInfo. Use this method with currentWindowAdaptiveInfoV2 to acquire Material-recommended dense-mode adaptive layout settings of the current activity window. Note that this function results in a dual-pane layout when the window width falls in the Medium size bucket, while calculatePaneScaffoldDirective results in a single-pane layout instead. We recommend to use calculatePaneScaffoldDirective, unless you have a strong use case to show two panes on a medium-width window, which can make your layout look too packed.

See more details on the Material design guideline site (https://m3.material.io/foundations/layout/applying-layout/window-size-classes).

Parameters
windowAdaptiveInfo: WindowAdaptiveInfo

WindowAdaptiveInfo that collects useful information in making layout adaptation decisions like androidx.window.core.layout.WindowSizeClass.

verticalHingePolicy: HingePolicy = HingePolicy.AvoidSeparating

HingePolicy that decides how layouts are supposed to address vertical hinges.

Returns
PaneScaffoldDirective

an PaneScaffoldDirective to be used to decide adaptive layout states.

calculateThreePaneScaffoldValue

@ExperimentalMaterial3AdaptiveApi
fun calculateThreePaneScaffoldValue(
    maxHorizontalPartitions: Int,
    adaptStrategies: ThreePaneScaffoldAdaptStrategies,
    currentDestination: ThreePaneScaffoldDestinationItem<*>?,
    maxVerticalPartitions: Int = 1
): ThreePaneScaffoldValue

Calculates the current adapted value of ThreePaneScaffold according to the given maxHorizontalPartitions, adaptStrategies and currentDestination. The returned value can be used as a unique representation of the current layout structure.

The function will treat the current destination as the highest priority and then adapt the rest panes according to the order of ThreePaneScaffoldRole.Primary, ThreePaneScaffoldRole.Secondary and ThreePaneScaffoldRole.Tertiary. If there are still remaining partitions to put the pane, the pane will be set as PaneAdaptedValue.Expanded, otherwise it will be adapted according to its associated AdaptStrategy.

Parameters
maxHorizontalPartitions: Int

The maximum allowed partitions along the horizontal axis, i.e., how many expanded panes can be shown at the same time.

adaptStrategies: ThreePaneScaffoldAdaptStrategies

The adapt strategies of each pane role that ThreePaneScaffold supports, the default value will be ThreePaneScaffoldDefaults.adaptStrategies.

currentDestination: ThreePaneScaffoldDestinationItem<*>?

The current destination item, which will be treated as having the highest priority, can be null.

maxVerticalPartitions: Int = 1

The maximum allowed partitions along the vertical axis, by default it will be 1 and in this case no reflowed panes will be allowed; if the value equals to or larger than 2, reflowed panes are allowed, besides the expanded pane in the same horizontal partition.

calculateThreePaneScaffoldValue

@ExperimentalMaterial3AdaptiveApi
fun calculateThreePaneScaffoldValue(
    maxHorizontalPartitions: Int,
    adaptStrategies: ThreePaneScaffoldAdaptStrategies,
    destinationHistory: List<ThreePaneScaffoldDestinationItem<*>>,
    maxVerticalPartitions: Int = 1
): ThreePaneScaffoldValue

Calculates the current adapted value of ThreePaneScaffold according to the given maxHorizontalPartitions, adaptStrategies and destinationHistory. The returned value can be used as a unique representation of the current layout structure.

The function will treat the current focus as the highest priority and then adapt the rest panes according to the order of ThreePaneScaffoldRole.Primary, ThreePaneScaffoldRole.Secondary and ThreePaneScaffoldRole.Tertiary. If there are still remaining partitions to put the pane, the pane will be set as PaneAdaptedValue.Expanded, otherwise it will be adapted according to its associated AdaptStrategy.

Parameters
maxHorizontalPartitions: Int

The maximum allowed partitions along the horizontal axis, i.e., how many expanded panes can be shown at the same time.

adaptStrategies: ThreePaneScaffoldAdaptStrategies

The adapt strategies of each pane role that ThreePaneScaffold supports, the default value will be ThreePaneScaffoldDefaults.adaptStrategies.

destinationHistory: List<ThreePaneScaffoldDestinationItem<*>>

The history of past destination items. The last destination will have the highest priority, and the second last destination will have the second highest priority, and so forth until all panes have a priority assigned. Note that the last destination is supposed to be the last item of the provided list.

maxVerticalPartitions: Int = 1

The maximum allowed partitions along the vertical axis, by default it will be 1 and in this case no reflowed panes will be allowed; if the value equals to or larger than 2, reflowed panes are allowed, besides the expanded pane in the same horizontal partition.

Extension functions

PaneScaffoldMotionDataProvider.calculateDefaultEnterTransition

@ExperimentalMaterial3AdaptiveApi
fun <Role : PaneScaffoldRole> PaneScaffoldMotionDataProvider<Role>.calculateDefaultEnterTransition(
    role: Role
): EnterTransition

Calculates the default EnterTransition of the pane associated to the given role when it's showing. The PaneMotion and pane measurement data provided by PaneScaffoldMotionDataProvider will be used to decide the transition type and relevant values like sliding offsets.

Parameters
role: Role

the role of the pane that is supposed to perform the EnterTransition when showing.

PaneScaffoldMotionDataProvider.calculateDefaultExitTransition

@ExperimentalMaterial3AdaptiveApi
fun <Role : PaneScaffoldRole> PaneScaffoldMotionDataProvider<Role>.calculateDefaultExitTransition(
    role: Role
): ExitTransition

Calculates the default ExitTransition of the pane associated to the given role when it's hiding. The PaneMotion and pane measurement data provided by PaneScaffoldMotionDataProvider will be used to decide the transition type and relevant values like sliding offsets.

Parameters
role: Role

the role of the pane that is supposed to perform the ExitTransition when hiding.

PaneScaffoldMotionDataProvider.forEach

@ExperimentalMaterial3AdaptiveApi
inline fun <Role : PaneScaffoldRole> PaneScaffoldMotionDataProvider<Role>.forEach(
    action: (Role, PaneMotionData) -> Unit
): Unit

Perform actions on each PaneMotionData, in the left-to-right order of the panes in the scaffold.

Parameters
action: (Role, PaneMotionData) -> Unit

action to perform on each PaneMotionData.

PaneScaffoldMotionDataProvider.forEachReversed

@ExperimentalMaterial3AdaptiveApi
inline fun <Role : PaneScaffoldRole> PaneScaffoldMotionDataProvider<Role>.forEachReversed(
    action: (Role, PaneMotionData) -> Unit
): Unit

Perform actions on each PaneMotionData, in the right-to-left order of the panes in the scaffold.

Parameters
action: (Role, PaneMotionData) -> Unit

action to perform on each PaneMotionData.

Top-level properties