Function

calculateThreePaneScaffoldValue

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

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free

calculateThreePaneScaffoldValue

Common
@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 The maximum allowed partitions along the horizontal axis, i.e., how many expanded panes can be shown at the same time.
adaptStrategies The adapt strategies of each pane role that ThreePaneScaffold supports, the default value will be ThreePaneScaffoldDefaults.adaptStrategies.
currentDestination The current destination item, which will be treated as having the highest priority, can be null.
maxVerticalPartitions 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

Common
@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 The maximum allowed partitions along the horizontal axis, i.e., how many expanded panes can be shown at the same time.
adaptStrategies The adapt strategies of each pane role that ThreePaneScaffold supports, the default value will be ThreePaneScaffoldDefaults.adaptStrategies.
destinationHistory 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 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.