TopAppBarDefaults


Contains default values used for the top app bar implementations.

Summary

Public functions

TopAppBarColors

Creates a TopAppBarColors for CenterAlignedTopAppBars.

Cmn
TopAppBarColors
@Composable
centerAlignedTopAppBarColors(
    containerColor: Color,
    scrolledContainerColor: Color,
    navigationIconContentColor: Color,
    titleContentColor: Color,
    actionIconContentColor: Color
)

Creates a TopAppBarColors for CenterAlignedTopAppBars.

Cmn
TopAppBarScrollBehavior
@ExperimentalMaterial3Api
@Composable
enterAlwaysScrollBehavior(
    state: TopAppBarState,
    canScroll: () -> Boolean,
    snapAnimationSpec: AnimationSpec<Float>?,
    flingAnimationSpec: DecayAnimationSpec<Float>?,
    reverseLayout: Boolean
)

Returns a TopAppBarScrollBehavior.

Cmn
TopAppBarScrollBehavior
@ExperimentalMaterial3Api
@Composable
exitUntilCollapsedScrollBehavior(
    state: TopAppBarState,
    canScroll: () -> Boolean,
    snapAnimationSpec: AnimationSpec<Float>?,
    flingAnimationSpec: DecayAnimationSpec<Float>?
)

Returns a TopAppBarScrollBehavior that adjusts its properties to affect the colors and height of the top app bar.

Cmn
TopAppBarColors

Creates a TopAppBarColors for LargeTopAppBars.

Cmn
TopAppBarColors
@Composable
largeTopAppBarColors(
    containerColor: Color,
    scrolledContainerColor: Color,
    navigationIconContentColor: Color,
    titleContentColor: Color,
    actionIconContentColor: Color
)

Creates a TopAppBarColors for LargeTopAppBars.

Cmn
TopAppBarColors

Creates a TopAppBarColors for MediumTopAppBars.

Cmn
TopAppBarColors
@Composable
mediumTopAppBarColors(
    containerColor: Color,
    scrolledContainerColor: Color,
    navigationIconContentColor: Color,
    titleContentColor: Color,
    actionIconContentColor: Color
)

Creates a TopAppBarColors for MediumTopAppBars.

Cmn
TopAppBarScrollBehavior

Returns a pinned TopAppBarScrollBehavior that tracks nested-scroll callbacks and updates its TopAppBarState.contentOffset accordingly.

Cmn
TopAppBarColors

Creates a TopAppBarColors for small TopAppBar.

Cmn
TopAppBarColors
@Composable
topAppBarColors(
    containerColor: Color,
    scrolledContainerColor: Color,
    navigationIconContentColor: Color,
    titleContentColor: Color,
    actionIconContentColor: Color
)

Creates a TopAppBarColors for small TopAppBar.

Cmn

Public properties

Dp

The default height of a LargeTopAppBar when collapsed by a TopAppBarScrollBehavior.

Cmn
Dp

The default expanded height of a LargeTopAppBar.

Cmn
Dp

The default expanded height of a LargeTopAppBar with subtitle.

Cmn
Dp

The default expanded height of a LargeTopAppBar without subtitle.

Cmn
Dp

The default height of a MediumTopAppBar when collapsed by a TopAppBarScrollBehavior.

Cmn
Dp

The default expanded height of a MediumTopAppBar.

Cmn
Dp

The default expanded height of a MediumTopAppBar with subtitle.

Cmn
Dp

The default expanded height of a MediumTopAppBar without subtitle.

Cmn
Dp

The default expanded height of a TopAppBar and the CenterAlignedTopAppBar.

Cmn
WindowInsets

Default insets to be used and consumed by the top app bars

Cmn

Public functions

centerAlignedTopAppBarColors

@Composable
fun centerAlignedTopAppBarColors(): TopAppBarColors

Creates a TopAppBarColors for CenterAlignedTopAppBars. The default implementation animates between the provided colors according to the Material Design specification.

centerAlignedTopAppBarColors

@Composable
fun centerAlignedTopAppBarColors(
    containerColor: Color = Color.Unspecified,
    scrolledContainerColor: Color = Color.Unspecified,
    navigationIconContentColor: Color = Color.Unspecified,
    titleContentColor: Color = Color.Unspecified,
    actionIconContentColor: Color = Color.Unspecified
): TopAppBarColors

Creates a TopAppBarColors for CenterAlignedTopAppBars. The default implementation animates between the provided colors according to the Material Design specification.

Parameters
containerColor: Color = Color.Unspecified

the container color

scrolledContainerColor: Color = Color.Unspecified

the container color when content is scrolled behind it

navigationIconContentColor: Color = Color.Unspecified

the content color used for the navigation icon

titleContentColor: Color = Color.Unspecified

the content color used for the title

actionIconContentColor: Color = Color.Unspecified

the content color used for actions

Returns
TopAppBarColors

the resulting TopAppBarColors used for the top app bar

enterAlwaysScrollBehavior

@ExperimentalMaterial3Api
@Composable
fun enterAlwaysScrollBehavior(
    state: TopAppBarState = rememberTopAppBarState(),
    canScroll: () -> Boolean = { true },
    snapAnimationSpec: AnimationSpec<Float>? = MotionSchemeKeyTokens.DefaultEffects.value(),
    flingAnimationSpec: DecayAnimationSpec<Float>? = rememberSplineBasedDecay(),
    reverseLayout: Boolean = false
): TopAppBarScrollBehavior

Returns a TopAppBarScrollBehavior. A top app bar that is set up with this TopAppBarScrollBehavior will immediately collapse when the content is pulled up, and will immediately appear when the content is pulled down.

Parameters
state: TopAppBarState = rememberTopAppBarState()

the state object to be used to control or observe the top app bar's scroll state. See rememberTopAppBarState for a state that is remembered across compositions.

canScroll: () -> Boolean = { true }

a callback used to determine whether scroll events are to be handled by this EnterAlwaysScrollBehavior

snapAnimationSpec: AnimationSpec<Float>? = MotionSchemeKeyTokens.DefaultEffects.value()

an optional AnimationSpec that defines how the top app bar snaps to either fully collapsed or fully extended state when a fling or a drag scrolled it into an intermediate position

flingAnimationSpec: DecayAnimationSpec<Float>? = rememberSplineBasedDecay()

an optional DecayAnimationSpec that defined how to fling the top app bar when the user flings the app bar itself, or the content below it

reverseLayout: Boolean = false

indicates that this behavior is applied to a scrollable content that has a reversed direction of scrolling and layout

exitUntilCollapsedScrollBehavior

@ExperimentalMaterial3Api
@Composable
fun exitUntilCollapsedScrollBehavior(
    state: TopAppBarState = rememberTopAppBarState(),
    canScroll: () -> Boolean = { true },
    snapAnimationSpec: AnimationSpec<Float>? = MotionSchemeKeyTokens.DefaultEffects.value(),
    flingAnimationSpec: DecayAnimationSpec<Float>? = rememberSplineBasedDecay()
): TopAppBarScrollBehavior

Returns a TopAppBarScrollBehavior that adjusts its properties to affect the colors and height of the top app bar.

A top app bar that is set up with this TopAppBarScrollBehavior will immediately collapse when the nested content is pulled up, and will expand back the collapsed area when the content is pulled all the way down.

Parameters
state: TopAppBarState = rememberTopAppBarState()

the state object to be used to control or observe the top app bar's scroll state. See rememberTopAppBarState for a state that is remembered across compositions.

canScroll: () -> Boolean = { true }

a callback used to determine whether scroll events are to be handled by this ExitUntilCollapsedScrollBehavior

snapAnimationSpec: AnimationSpec<Float>? = MotionSchemeKeyTokens.DefaultEffects.value()

an optional AnimationSpec that defines how the top app bar snaps to either fully collapsed or fully extended state when a fling or a drag scrolled it into an intermediate position

flingAnimationSpec: DecayAnimationSpec<Float>? = rememberSplineBasedDecay()

an optional DecayAnimationSpec that defined how to fling the top app bar when the user flings the app bar itself, or the content below it

largeTopAppBarColors

@Composable
fun largeTopAppBarColors(): TopAppBarColors

Creates a TopAppBarColors for LargeTopAppBars. The default implementation interpolates between the provided colors as the top app bar scrolls according to the Material Design specification.

largeTopAppBarColors

@Composable
fun largeTopAppBarColors(
    containerColor: Color = Color.Unspecified,
    scrolledContainerColor: Color = Color.Unspecified,
    navigationIconContentColor: Color = Color.Unspecified,
    titleContentColor: Color = Color.Unspecified,
    actionIconContentColor: Color = Color.Unspecified
): TopAppBarColors

Creates a TopAppBarColors for LargeTopAppBars. The default implementation interpolates between the provided colors as the top app bar scrolls according to the Material Design specification.

Parameters
containerColor: Color = Color.Unspecified

the container color

scrolledContainerColor: Color = Color.Unspecified

the container color when content is scrolled behind it

navigationIconContentColor: Color = Color.Unspecified

the content color used for the navigation icon

titleContentColor: Color = Color.Unspecified

the content color used for the title

actionIconContentColor: Color = Color.Unspecified

the content color used for actions

Returns
TopAppBarColors

the resulting TopAppBarColors used for the top app bar

mediumTopAppBarColors

@Composable
fun mediumTopAppBarColors(): TopAppBarColors

Creates a TopAppBarColors for MediumTopAppBars. The default implementation interpolates between the provided colors as the top app bar scrolls according to the Material Design specification.

mediumTopAppBarColors

@Composable
fun mediumTopAppBarColors(
    containerColor: Color = Color.Unspecified,
    scrolledContainerColor: Color = Color.Unspecified,
    navigationIconContentColor: Color = Color.Unspecified,
    titleContentColor: Color = Color.Unspecified,
    actionIconContentColor: Color = Color.Unspecified
): TopAppBarColors

Creates a TopAppBarColors for MediumTopAppBars. The default implementation interpolates between the provided colors as the top app bar scrolls according to the Material Design specification.

Parameters
containerColor: Color = Color.Unspecified

the container color

scrolledContainerColor: Color = Color.Unspecified

the container color when content is scrolled behind it

navigationIconContentColor: Color = Color.Unspecified

the content color used for the navigation icon

titleContentColor: Color = Color.Unspecified

the content color used for the title

actionIconContentColor: Color = Color.Unspecified

the content color used for actions

Returns
TopAppBarColors

the resulting TopAppBarColors used for the top app bar

pinnedScrollBehavior

@ExperimentalMaterial3Api
@Composable
fun pinnedScrollBehavior(
    state: TopAppBarState = rememberTopAppBarState(),
    canScroll: () -> Boolean = { true }
): TopAppBarScrollBehavior

Returns a pinned TopAppBarScrollBehavior that tracks nested-scroll callbacks and updates its TopAppBarState.contentOffset accordingly.

Parameters
state: TopAppBarState = rememberTopAppBarState()

the state object to be used to control or observe the top app bar's scroll state. See rememberTopAppBarState for a state that is remembered across compositions.

canScroll: () -> Boolean = { true }

a callback used to determine whether scroll events are to be handled by this pinned TopAppBarScrollBehavior

topAppBarColors

@Composable
fun topAppBarColors(): TopAppBarColors

Creates a TopAppBarColors for small TopAppBar. The default implementation animates between the provided colors according to the Material Design specification.

topAppBarColors

@Composable
fun topAppBarColors(
    containerColor: Color = Color.Unspecified,
    scrolledContainerColor: Color = Color.Unspecified,
    navigationIconContentColor: Color = Color.Unspecified,
    titleContentColor: Color = Color.Unspecified,
    actionIconContentColor: Color = Color.Unspecified
): TopAppBarColors

Creates a TopAppBarColors for small TopAppBar. The default implementation animates between the provided colors according to the Material Design specification.

Parameters
containerColor: Color = Color.Unspecified

the container color

scrolledContainerColor: Color = Color.Unspecified

the container color when content is scrolled behind it

navigationIconContentColor: Color = Color.Unspecified

the content color used for the navigation icon

titleContentColor: Color = Color.Unspecified

the content color used for the title

actionIconContentColor: Color = Color.Unspecified

the content color used for actions

Returns
TopAppBarColors

the resulting TopAppBarColors used for the top app bar

Public properties

LargeAppBarCollapsedHeight

val LargeAppBarCollapsedHeightDp

The default height of a LargeTopAppBar when collapsed by a TopAppBarScrollBehavior.

LargeAppBarExpandedHeight

val LargeAppBarExpandedHeightDp

The default expanded height of a LargeTopAppBar.

LargeAppBarWithSubtitleExpandedHeight

val LargeAppBarWithSubtitleExpandedHeightDp

The default expanded height of a LargeTopAppBar with subtitle.

LargeAppBarWithoutSubtitleExpandedHeight

val LargeAppBarWithoutSubtitleExpandedHeightDp

The default expanded height of a LargeTopAppBar without subtitle.

MediumAppBarCollapsedHeight

val MediumAppBarCollapsedHeightDp

The default height of a MediumTopAppBar when collapsed by a TopAppBarScrollBehavior.

MediumAppBarExpandedHeight

val MediumAppBarExpandedHeightDp

The default expanded height of a MediumTopAppBar.

MediumAppBarWithSubtitleExpandedHeight

val MediumAppBarWithSubtitleExpandedHeightDp

The default expanded height of a MediumTopAppBar with subtitle.

MediumAppBarWithoutSubtitleExpandedHeight

val MediumAppBarWithoutSubtitleExpandedHeightDp

The default expanded height of a MediumTopAppBar without subtitle.

TopAppBarExpandedHeight

val TopAppBarExpandedHeightDp

The default expanded height of a TopAppBar and the CenterAlignedTopAppBar.

windowInsets

val windowInsetsWindowInsets

Default insets to be used and consumed by the top app bars