Scope for the panes of ThreePaneScaffold.

Summary

Public properties

EnterTransition

The EnterTransition of the associated pane.

Cmn
ExitTransition

The ExitTransition of the associated pane.

Cmn
FiniteAnimationSpec<IntOffset>

The position animation spec of the associated pane to the scope.

Cmn
ThreePaneScaffoldRole

The ThreePaneScaffoldRole of the current pane in the scope.

Cmn
Transition<ThreePaneScaffoldValue>

The current scaffold state transition between ThreePaneScaffoldValues.

Cmn
Float

The current fraction of the scaffold state transition.

Cmn
FiniteAnimationSpec<IntSize>

The size animation spec of the associated pane to the scope.

Cmn

Extension functions

Unit

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

Cmn

Inherited functions

From androidx.compose.ui.layout.LookaheadScope
open Offset
@ExperimentalComposeUiApi
LayoutCoordinates.localLookaheadPositionOf(
    coordinates: LayoutCoordinates,
    excludeDirectManipulationOffset: Boolean
)

Calculates the localPosition in the Lookahead coordinate space.

Cmn
LayoutCoordinates

Converts a LayoutCoordinates into a LayoutCoordinates in the Lookahead coordinates space.

Cmn
From androidx.compose.material3.adaptive.layout.PaneScaffoldScope
Modifier

This modifier specifies the preferred width for a pane, and the pane scaffold implementation will try its best to respect this width when the associated pane is rendered as a fixed pane, i.e., a pane that are not stretching to fill the remaining spaces.

Cmn

Public properties

enterTransition

val enterTransitionEnterTransition

The EnterTransition of the associated pane. AnimatedPane will use this value to perform pane entering animations when it's showing during scaffold state changes.

exitTransition

val exitTransitionExitTransition

The ExitTransition of the associated pane. AnimatedPane will use this value to perform pane exiting animations when it's hiding during scaffold state changes.

positionAnimationSpec

val positionAnimationSpecFiniteAnimationSpec<IntOffset>

The position animation spec of the associated pane to the scope. AnimatedPane will use this value to perform pane animations during scaffold state changes.

role

val roleThreePaneScaffoldRole

The ThreePaneScaffoldRole of the current pane in the scope.

scaffoldStateTransition

val scaffoldStateTransitionTransition<ThreePaneScaffoldValue>

The current scaffold state transition between ThreePaneScaffoldValues.

scaffoldStateTransitionFraction

val scaffoldStateTransitionFractionFloat

The current fraction of the scaffold state transition.

sizeAnimationSpec

val sizeAnimationSpecFiniteAnimationSpec<IntSize>

The size animation spec of the associated pane to the scope. AnimatedPane will use this value to perform pane animations during scaffold state changes.

Extension functions

@ExperimentalMaterial3AdaptiveApi
@Composable
fun ThreePaneScaffoldScope.AnimatedPane(
    modifier: Modifier = Modifier,
    content: @Composable AnimatedPaneScope.() -> Unit
): Unit

The root composable of pane contents in a ThreePaneScaffold that supports default motions during pane switching. It's recommended to use this composable to wrap your own contents when passing them into pane parameters of the scaffold functions, therefore your panes can have a nice default animation for free.

import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.adaptive.layout.AnimatedPane
import androidx.compose.material3.adaptive.layout.ListDetailPaneScaffold
import androidx.compose.material3.adaptive.layout.ListDetailPaneScaffoldRole
import androidx.compose.material3.adaptive.navigation.rememberListDetailPaneScaffoldNavigator
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp

val scaffoldNavigator = rememberListDetailPaneScaffoldNavigator()
ListDetailPaneScaffold(
    directive = scaffoldNavigator.scaffoldDirective,
    value = scaffoldNavigator.scaffoldValue,
    listPane = {
        AnimatedPane(
            modifier = Modifier.preferredWidth(200.dp),
        ) {
            Surface(
                color = MaterialTheme.colorScheme.secondary,
                onClick = {
                    scaffoldNavigator.navigateTo(ListDetailPaneScaffoldRole.Detail)
                }
            ) {
                Text("List")
            }
        }
    },
    detailPane = {
        AnimatedPane(modifier = Modifier) {
            Surface(
                color = MaterialTheme.colorScheme.primary,
                onClick = {
                    scaffoldNavigator.navigateBack()
                }
            ) {
                Text("Details")
            }
        }
    }
)
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.VerticalDivider
import androidx.compose.material3.adaptive.layout.AnimatedPane
import androidx.compose.material3.adaptive.layout.ListDetailPaneScaffold
import androidx.compose.material3.adaptive.layout.ListDetailPaneScaffoldRole
import androidx.compose.material3.adaptive.navigation.rememberListDetailPaneScaffoldNavigator
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp

val scaffoldNavigator = rememberListDetailPaneScaffoldNavigator()
ListDetailPaneScaffold(
    directive = scaffoldNavigator.scaffoldDirective,
    value = scaffoldNavigator.scaffoldValue,
    listPane = {
        AnimatedPane(
            modifier = Modifier.preferredWidth(200.dp),
        ) {
            Surface(
                color = MaterialTheme.colorScheme.secondary,
                onClick = {
                    scaffoldNavigator.navigateTo(ListDetailPaneScaffoldRole.Detail)
                }
            ) {
                Text("List")
            }
        }
    },
    detailPane = {
        AnimatedPane(
            modifier = Modifier
        ) {
            Surface(
                color = MaterialTheme.colorScheme.primary,
            ) {
                Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {
                    Text("Detail")
                    Row(
                        modifier = Modifier
                            .fillMaxWidth()
                            .padding(horizontal = 4.dp),
                        horizontalArrangement = Arrangement.spacedBy(8.dp)
                    ) {
                        Surface(
                            onClick = {
                                scaffoldNavigator.navigateBack()
                            },
                            modifier = Modifier
                                .weight(0.5f)
                                .fillMaxHeight(),
                            color = MaterialTheme.colorScheme.primary.copy(alpha = 0.8f)
                        ) {
                            Box(
                                modifier = Modifier.fillMaxSize(),
                                contentAlignment = Alignment.Center
                            ) {
                                Text("Previous")
                            }
                        }
                        VerticalDivider()
                        Surface(
                            onClick = {
                                scaffoldNavigator.navigateTo(ListDetailPaneScaffoldRole.Extra)
                            },
                            modifier = Modifier
                                .weight(0.5f)
                                .fillMaxHeight(),
                            color = MaterialTheme.colorScheme.primary.copy(alpha = 0.6f)
                        ) {
                            Box(
                                modifier = Modifier.fillMaxSize(),
                                contentAlignment = Alignment.Center
                            ) {
                                Text("Next")
                            }
                        }
                    }
                }
            }
        }
    },
    extraPane = {
        AnimatedPane(
            modifier = Modifier.fillMaxSize()
        ) {
            Surface(
                modifier = Modifier.fillMaxSize(),
                color = MaterialTheme.colorScheme.tertiary,
                onClick = {
                    scaffoldNavigator.navigateBack()
                }
            ) {
                Text("Extra")
            }
        }
    }
)
Parameters
modifier: Modifier = Modifier

The modifier applied to the AnimatedPane.

content: @Composable AnimatedPaneScope.() -> Unit

The content of the AnimatedPane. Also see AnimatedPaneScope.

See usage samples at: