androidx.compose.material3
FloatingToolbarDefaultsSince 1.10
Object
No hand-written docs yet.
Contains default values used for the floating toolbar implementations.
object FloatingToolbarDefaults
Properties
ContainerSize
val ContainerSize: Dp
Default size used for HorizontalFloatingToolbar and VerticalFloatingToolbar container
ContainerExpandedElevation
val ContainerExpandedElevation: Dp
Default expanded elevation used for HorizontalFloatingToolbar and VerticalFloatingToolbar
ContainerCollapsedElevation
val ContainerCollapsedElevation: Dp
Default collapsed elevation used for HorizontalFloatingToolbar and VerticalFloatingToolbar
ContainerExpandedElevationWithFab
val ContainerExpandedElevationWithFab: Dp
Default expanded elevation used for HorizontalFloatingToolbar and VerticalFloatingToolbar with FAB.
ContainerCollapsedElevationWithFab
val ContainerCollapsedElevationWithFab: Dp
Default collapsed elevation used for HorizontalFloatingToolbar and VerticalFloatingToolbar with FAB.
ContainerShape
@Composable val ContainerShape: Shape
Default shape used for HorizontalFloatingToolbar and VerticalFloatingToolbar
ContentPadding
val ContentPadding: PaddingValues
Default padding used for HorizontalFloatingToolbar and VerticalFloatingToolbar when content are default size (24dp) icons in IconButton that meet the minimum touch target (48.dp).
ScreenOffset
val ScreenOffset: Dp
Default offset from the edge of the screen used for HorizontalFloatingToolbar and VerticalFloatingToolbar.
ScrollDistanceThreshold
val ScrollDistanceThreshold: Dp
A default threshold in Dp for the content's scrolling that defines when the toolbar should be collapsed or expanded.
Functions
animationSpec
@Composable
fun <T> animationSpec(): FiniteAnimationSpec<T>
Returns a default animation spec used for HorizontalFloatingToolbars and VerticalFloatingToolbars.
exitAlwaysScrollBehavior
@Composable
fun exitAlwaysScrollBehavior(
exitDirection: FloatingToolbarExitDirection,
state: FloatingToolbarState = rememberFloatingToolbarState(),
snapAnimationSpec: AnimationSpec<Float> = MotionSchemeKeyTokens.DefaultEffects.value(),
flingAnimationSpec: DecayAnimationSpec<Float> = rememberSplineBasedDecay(),
): FloatingToolbarScrollBehavior
Returns a FloatingToolbarScrollBehavior. A floating toolbar that is set up with this FloatingToolbarScrollBehavior will immediately collapse when the content is pulled up, and will immediately appear when the content is pulled down. Note that this scroll behavior may impact assistive technologies making the component inaccessible. See on how to disable scrolling when touch exploration is enabled.
horizontalEnterTransition
@Composable
fun horizontalEnterTransition(expandFrom: Alignment.Horizontal)
Default enter transition used for HorizontalFloatingToolbar when expanding
verticalEnterTransition
@Composable
fun verticalEnterTransition(expandFrom: Alignment.Vertical)
Default enter transition used for VerticalFloatingToolbar when expanding
horizontalExitTransition
@Composable
fun horizontalExitTransition(shrinkTowards: Alignment.Horizontal)
Default exit transition used for HorizontalFloatingToolbar when shrinking
verticalExitTransition
@Composable
fun verticalExitTransition(shrinkTowards: Alignment.Vertical)
Default exit transition used for VerticalFloatingToolbar when shrinking
standardFloatingToolbarColors
@Composable
fun standardFloatingToolbarColors(): FloatingToolbarColors
Creates a FloatingToolbarColors that represents the default standard colors used in the various floating toolbars.
vibrantFloatingToolbarColors
@Composable
fun vibrantFloatingToolbarColors(): FloatingToolbarColors
Creates a FloatingToolbarColors that represents the default vibrant colors used in the various floating toolbars.
@Composable
fun standardFloatingToolbarColors(
toolbarContainerColor: Color = Color.Unspecified,
toolbarContentColor: Color = Color.Unspecified,
fabContainerColor: Color = Color.Unspecified,
fabContentColor: Color = Color.Unspecified,
): FloatingToolbarColors
Creates a FloatingToolbarColors that represents the default standard colors used in the various floating toolbars.
@Composable
fun vibrantFloatingToolbarColors(
toolbarContainerColor: Color = Color.Unspecified,
toolbarContentColor: Color = Color.Unspecified,
fabContainerColor: Color = Color.Unspecified,
fabContentColor: Color = Color.Unspecified,
): FloatingToolbarColors
Creates a FloatingToolbarColors that represents the default vibrant colors used in the various floating toolbars.
VibrantFloatingActionButton
@Composable
fun VibrantFloatingActionButton(
onClick: () -> Unit,
modifier: Modifier = Modifier,
shape: Shape = FloatingActionButtonDefaults.shape,
containerColor: Color = vibrantFloatingToolbarColors().fabContainerColor,
contentColor: Color = vibrantFloatingToolbarColors().fabContentColor,
interactionSource: MutableInteractionSource? = null,
content: @Composable () -> Unit,
)
Creates a FloatingActionButton that represents a toolbar floating action button with vibrant colors.
StandardFloatingActionButton
@Composable
fun StandardFloatingActionButton(
onClick: () -> Unit,
modifier: Modifier = Modifier,
shape: Shape = FloatingActionButtonDefaults.shape,
containerColor: Color = standardFloatingToolbarColors().fabContainerColor,
contentColor: Color = standardFloatingToolbarColors().fabContentColor,
interactionSource: MutableInteractionSource? = null,
content: @Composable () -> Unit,
)
Creates a FloatingActionButton that represents a toolbar floating action button with standard colors.
floatingToolbarVerticalNestedScroll
fun Modifier.floatingToolbarVerticalNestedScroll(
expanded: Boolean,
onExpand: () -> Unit,
onCollapse: () -> Unit,
expandScrollDistanceThreshold: Dp = ScrollDistanceThreshold,
collapseScrollDistanceThreshold: Dp = ScrollDistanceThreshold,
reverseLayout: Boolean = false,
): Modifier
This Modifier tracks vertical scroll events on the scrolling container that a floating toolbar appears above. It then calls onExpand and onCollapse to adjust the toolbar's state based on the scroll direction and distance.
Library docs
Contains default values used for the floating toolbar implementations.