/* * Copyright 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package androidx.compose.material3 import androidx.compose.animation.animateColorAsState import androidx.compose.animation.core.animateFloatAsState import androidx.compose.animation.core.tween import androidx.compose.foundation.background import androidx.compose.foundation.indication import androidx.compose.foundation.interaction.Interaction import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.defaultMinSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.foundation.selection.selectable import androidx.compose.foundation.selection.selectableGroup import androidx.compose.material3.internal.MappedInteractionSource import androidx.compose.material3.internal.ProvideContentColorTextStyle import androidx.compose.material3.internal.systemBarsForVisualComponents import androidx.compose.material3.tokens.ElevationTokens import androidx.compose.material3.tokens.NavigationBarTokens import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.Immutable import androidx.compose.runtime.Stable import androidx.compose.runtime.State import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.graphics.takeOrElse import androidx.compose.ui.layout.Layout import androidx.compose.ui.layout.MeasureResult import androidx.compose.ui.layout.MeasureScope import androidx.compose.ui.layout.Placeable import androidx.compose.ui.layout.layoutId import androidx.compose.ui.layout.onSizeChanged import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.semantics.Role import androidx.compose.ui.semantics.clearAndSetSemantics import androidx.compose.ui.unit.Constraints import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.constrainHeight import androidx.compose.ui.unit.dp import androidx.compose.ui.util.fastFirst import androidx.compose.ui.util.fastFirstOrNull import kotlin.math.roundToInt /** * Material Design bottom navigation bar. * * Navigation bars offer a persistent and convenient way to switch between primary destinations in * an app. * * ![Navigation bar image](https://developer.android.com/images/reference/androidx/compose/material3/navigation-bar.png) * * [NavigationBar] should contain three to five [NavigationBarItem]s, each representing a singular * destination. * * A simple example looks like: * @sample androidx.compose.material3.samples.NavigationBarSample * * See [NavigationBarItem] for configuration specific to each item, and not the overall * [NavigationBar] component. * * @param modifier the [Modifier] to be applied to this navigation bar * @param containerColor the color used for the background of this navigation bar. Use * [Color.Transparent] to have no color. * @param contentColor the preferred color for content inside this navigation bar. Defaults to * either the matching content color for [containerColor], or to the current [LocalContentColor] if * [containerColor] is not a color from the theme. * @param tonalElevation when [containerColor] is [ColorScheme.surface], a translucent primary color * overlay is applied on top of the container. A higher tonal elevation value will result in a * darker color in light theme and lighter color in dark theme. See also: [Surface]. * @param windowInsets a window insets of the navigation bar. * @param content the content of this navigation bar, typically 3-5 [NavigationBarItem]s */ @Composable fun NavigationBar( modifier: Modifier = Modifier, containerColor: Color = NavigationBarDefaults.containerColor, contentColor: Color = MaterialTheme.colorScheme.contentColorFor(containerColor), tonalElevation: Dp = NavigationBarDefaults.Elevation, windowInsets: WindowInsets = NavigationBarDefaults.windowInsets, content: @Composable RowScope.() -> Unit ) { Surface( color = containerColor, contentColor = contentColor, tonalElevation = tonalElevation, modifier = modifier ) { Row( modifier = Modifier .fillMaxWidth() .windowInsetsPadding(windowInsets) .defaultMinSize(minHeight = NavigationBarHeight) .selectableGroup(), horizontalArrangement = Arrangement.spacedBy(NavigationBarItemHorizontalPadding), verticalAlignment = Alignment.CenterVertically, content = content ) } } /** * Material Design navigation bar item. * * Navigation bars offer a persistent and convenient way to switch between primary destinations in * an app. * * The recommended configuration for a [NavigationBarItem] depends on how many items there are * inside a [NavigationBar]: * * - Three destinations: Display icons and text labels for all destinations. * - Four destinations: Active destinations display an icon and text label. Inactive destinations * display icons, and text labels are recommended. * - Five destinations: Active destinations display an icon and text label. Inactive destinations * use icons, and use text labels if space permits. * * A [NavigationBarItem] always shows text labels (if it exists) when selected. Showing text * labels if not selected is controlled by [alwaysShowLabel]. * * @param selected whether this item is selected * @param onClick called when this item is clicked * @param icon icon for this item, typically an [Icon] * @param modifier the [Modifier] to be applied to this item * @param enabled controls the enabled state of this item. When `false`, this component will not * respond to user input, and it will appear visually disabled and disabled to accessibility * services. * @param label optional text label for this item * @param alwaysShowLabel whether to always show the label for this item. If `false`, the label will * only be shown when this item is selected. * @param colors [NavigationBarItemColors] that will be used to resolve the colors used for this * item in different states. See [NavigationBarItemDefaults.colors]. * @param interactionSource an optional hoisted [MutableInteractionSource] for observing and * emitting [Interaction]s for this item. You can use this to change the item's appearance * or preview the item in different states. Note that if `null` is provided, interactions will * still happen internally. */ @Composable fun RowScope.NavigationBarItem( selected: Boolean, onClick: () -> Unit, icon: @Composable () -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, label: @Composable (() -> Unit)? = null, alwaysShowLabel: Boolean = true, colors: NavigationBarItemColors = NavigationBarItemDefaults.colors(), interactionSource: MutableInteractionSource? = null ) { @Suppress("NAME_SHADOWING") val interactionSource = interactionSource ?: remember { MutableInteractionSource() } val styledIcon = @Composable { val iconColor by animateColorAsState( targetValue = colors.iconColor(selected = selected, enabled = enabled), animationSpec = tween(ItemAnimationDurationMillis) ) // If there's a label, don't have a11y services repeat the icon description. val clearSemantics = label != null && (alwaysShowLabel || selected) Box(modifier = if (clearSemantics) Modifier.clearAndSetSemantics {} else Modifier) { CompositionLocalProvider(LocalContentColor provides iconColor, content = icon) } } val styledLabel: @Composable (() -> Unit)? = label?.let { @Composable { val style = NavigationBarTokens.LabelTextFont.value val textColor by animateColorAsState( targetValue = colors.textColor(selected = selected, enabled = enabled), animationSpec = tween(ItemAnimationDurationMillis) ) ProvideContentColorTextStyle( contentColor = textColor, textStyle = style, content = label ) } } var itemWidth by remember { mutableIntStateOf(0) } Box( modifier .selectable( selected = selected, onClick = onClick, enabled = enabled, role = Role.Tab, interactionSource = interactionSource, indication = null, ) .defaultMinSize(minHeight = NavigationBarHeight) .weight(1f) .onSizeChanged { itemWidth = it.width }, contentAlignment = Alignment.Center, propagateMinConstraints = true, ) { val animationProgress: State = animateFloatAsState( targetValue = if (selected) 1f else 0f, animationSpec = tween(ItemAnimationDurationMillis) ) // The entire item is selectable, but only the indicator pill shows the ripple. To achieve // this, we re-map the coordinates of the item's InteractionSource into the coordinates of // the indicator. val deltaOffset: Offset with(LocalDensity.current) { val indicatorWidth = NavigationBarTokens.ActiveIndicatorWidth.roundToPx() deltaOffset = Offset( (itemWidth - indicatorWidth).toFloat() / 2, IndicatorVerticalOffset.toPx() ) } val offsetInteractionSource = remember(interactionSource, deltaOffset) { MappedInteractionSource(interactionSource, deltaOffset) } // The indicator has a width-expansion animation which interferes with the timing of the // ripple, which is why they are separate composables val indicatorRipple = @Composable { Box( Modifier .layoutId(IndicatorRippleLayoutIdTag) .clip(NavigationBarTokens.ActiveIndicatorShape.value) .indication(offsetInteractionSource, rippleOrFallbackImplementation()) ) } val indicator = @Composable { Box( Modifier .layoutId(IndicatorLayoutIdTag) .graphicsLayer { alpha = animationProgress.value } .background( color = colors.indicatorColor, shape = NavigationBarTokens.ActiveIndicatorShape.value, ) ) } NavigationBarItemLayout( indicatorRipple = indicatorRipple, indicator = indicator, icon = styledIcon, label = styledLabel, alwaysShowLabel = alwaysShowLabel, animationProgress = { animationProgress.value }, ) } } /** Defaults used in [NavigationBar]. */ object NavigationBarDefaults { /** Default elevation for a navigation bar. */ val Elevation: Dp = ElevationTokens.Level0 /** Default color for a navigation bar. */ val containerColor: Color @Composable get() = NavigationBarTokens.ContainerColor.value /** * Default window insets to be used and consumed by navigation bar */ val windowInsets: WindowInsets @Composable get() = WindowInsets.systemBarsForVisualComponents .only(WindowInsetsSides.Horizontal + WindowInsetsSides.Bottom) } /** Defaults used in [NavigationBarItem]. */ object NavigationBarItemDefaults { /** * Creates a [NavigationBarItemColors] with the provided colors according to the Material * specification. */ @Composable fun colors() = MaterialTheme.colorScheme.defaultNavigationBarItemColors /** * Creates a [NavigationBarItemColors] with the provided colors according to the Material * specification. * * @param selectedIconColor the color to use for the icon when the item is selected. * @param selectedTextColor the color to use for the text label when the item is selected. * @param indicatorColor the color to use for the indicator when the item is selected. * @param unselectedIconColor the color to use for the icon when the item is unselected. * @param unselectedTextColor the color to use for the text label when the item is unselected. * @param disabledIconColor the color to use for the icon when the item is disabled. * @param disabledTextColor the color to use for the text label when the item is disabled. * @return the resulting [NavigationBarItemColors] used for [NavigationBarItem] */ @Composable fun colors( selectedIconColor: Color = Color.Unspecified, selectedTextColor: Color = Color.Unspecified, indicatorColor: Color = Color.Unspecified, unselectedIconColor: Color = Color.Unspecified, unselectedTextColor: Color = Color.Unspecified, disabledIconColor: Color = Color.Unspecified, disabledTextColor: Color = Color.Unspecified, ): NavigationBarItemColors = MaterialTheme.colorScheme.defaultNavigationBarItemColors.copy( selectedIconColor = selectedIconColor, selectedTextColor = selectedTextColor, selectedIndicatorColor = indicatorColor, unselectedIconColor = unselectedIconColor, unselectedTextColor = unselectedTextColor, disabledIconColor = disabledIconColor, disabledTextColor = disabledTextColor, ) internal val ColorScheme.defaultNavigationBarItemColors: NavigationBarItemColors get() { return defaultNavigationBarItemColorsCached ?: NavigationBarItemColors( selectedIconColor = fromToken(NavigationBarTokens.ActiveIconColor), selectedTextColor = fromToken(NavigationBarTokens.ActiveLabelTextColor), selectedIndicatorColor = fromToken(NavigationBarTokens.ActiveIndicatorColor), unselectedIconColor = fromToken(NavigationBarTokens.InactiveIconColor), unselectedTextColor = fromToken(NavigationBarTokens.InactiveLabelTextColor), disabledIconColor = fromToken(NavigationBarTokens.InactiveIconColor).copy(alpha = DisabledAlpha), disabledTextColor = fromToken(NavigationBarTokens.InactiveLabelTextColor).copy(alpha = DisabledAlpha), ).also { defaultNavigationBarItemColorsCached = it } } @Deprecated( "Use overload with disabledIconColor and disabledTextColor", level = DeprecationLevel.HIDDEN ) @Composable fun colors( selectedIconColor: Color = NavigationBarTokens.ActiveIconColor.value, selectedTextColor: Color = NavigationBarTokens.ActiveLabelTextColor.value, indicatorColor: Color = NavigationBarTokens.ActiveIndicatorColor.value, unselectedIconColor: Color = NavigationBarTokens.InactiveIconColor.value, unselectedTextColor: Color = NavigationBarTokens.InactiveLabelTextColor.value, ): NavigationBarItemColors = NavigationBarItemColors( selectedIconColor = selectedIconColor, selectedTextColor = selectedTextColor, selectedIndicatorColor = indicatorColor, unselectedIconColor = unselectedIconColor, unselectedTextColor = unselectedTextColor, disabledIconColor = unselectedIconColor.copy(alpha = DisabledAlpha), disabledTextColor = unselectedTextColor.copy(alpha = DisabledAlpha), ) } /** * Represents the colors of the various elements of a navigation item. * * @constructor create an instance with arbitrary colors. * * @param selectedIconColor the color to use for the icon when the item is selected. * @param selectedTextColor the color to use for the text label when the item is selected. * @param selectedIndicatorColor the color to use for the indicator when the item is selected. * @param unselectedIconColor the color to use for the icon when the item is unselected. * @param unselectedTextColor the color to use for the text label when the item is unselected. * @param disabledIconColor the color to use for the icon when the item is disabled. * @param disabledTextColor the color to use for the text label when the item is disabled. */ @Immutable class NavigationBarItemColors constructor( val selectedIconColor: Color, val selectedTextColor: Color, val selectedIndicatorColor: Color, val unselectedIconColor: Color, val unselectedTextColor: Color, val disabledIconColor: Color, val disabledTextColor: Color, ) { /** * Returns a copy of this NavigationBarItemColors, optionally overriding some of the values. * This uses the Color.Unspecified to mean “use the value from the source” */ fun copy( selectedIconColor: Color = this.selectedIconColor, selectedTextColor: Color = this.selectedTextColor, selectedIndicatorColor: Color = this.selectedIndicatorColor, unselectedIconColor: Color = this.unselectedIconColor, unselectedTextColor: Color = this.unselectedTextColor, disabledIconColor: Color = this.disabledIconColor, disabledTextColor: Color = this.disabledTextColor, ) = NavigationBarItemColors( selectedIconColor.takeOrElse { this.selectedIconColor }, selectedTextColor.takeOrElse { this.selectedTextColor }, selectedIndicatorColor.takeOrElse { this.selectedIndicatorColor }, unselectedIconColor.takeOrElse { this.unselectedIconColor }, unselectedTextColor.takeOrElse { this.unselectedTextColor }, disabledIconColor.takeOrElse { this.disabledIconColor }, disabledTextColor.takeOrElse { this.disabledTextColor }, ) /** * Represents the icon color for this item, depending on whether it is [selected]. * * @param selected whether the item is selected * @param enabled whether the item is enabled */ @Stable internal fun iconColor(selected: Boolean, enabled: Boolean): Color = when { !enabled -> disabledIconColor selected -> selectedIconColor else -> unselectedIconColor } /** * Represents the text color for this item, depending on whether it is [selected]. * * @param selected whether the item is selected * @param enabled whether the item is enabled */ @Stable internal fun textColor(selected: Boolean, enabled: Boolean): Color = when { !enabled -> disabledTextColor selected -> selectedTextColor else -> unselectedTextColor } /** Represents the color of the indicator used for selected items. */ internal val indicatorColor: Color get() = selectedIndicatorColor override fun equals(other: Any?): Boolean { if (this === other) return true if (other == null || other !is NavigationBarItemColors) return false if (selectedIconColor != other.selectedIconColor) return false if (unselectedIconColor != other.unselectedIconColor) return false if (selectedTextColor != other.selectedTextColor) return false if (unselectedTextColor != other.unselectedTextColor) return false if (selectedIndicatorColor != other.selectedIndicatorColor) return false if (disabledIconColor != other.disabledIconColor) return false if (disabledTextColor != other.disabledTextColor) return false return true } override fun hashCode(): Int { var result = selectedIconColor.hashCode() result = 31 * result + unselectedIconColor.hashCode() result = 31 * result + selectedTextColor.hashCode() result = 31 * result + unselectedTextColor.hashCode() result = 31 * result + selectedIndicatorColor.hashCode() result = 31 * result + disabledIconColor.hashCode() result = 31 * result + disabledTextColor.hashCode() return result } } /** * Base layout for a [NavigationBarItem]. * * @param indicatorRipple indicator ripple for this item when it is selected * @param indicator indicator for this item when it is selected * @param icon icon for this item * @param label text label for this item * @param alwaysShowLabel whether to always show the label for this item. If false, the label will * only be shown when this item is selected. * @param animationProgress progress of the animation, where 0 represents the unselected state of * this item and 1 represents the selected state. This value controls other values such as indicator * size, icon and label positions, etc. */ @Composable private fun NavigationBarItemLayout( indicatorRipple: @Composable () -> Unit, indicator: @Composable () -> Unit, icon: @Composable () -> Unit, label: @Composable (() -> Unit)?, alwaysShowLabel: Boolean, animationProgress: () -> Float, ) { Layout({ indicatorRipple() indicator() Box(Modifier.layoutId(IconLayoutIdTag)) { icon() } if (label != null) { Box( Modifier .layoutId(LabelLayoutIdTag) .graphicsLayer { alpha = if (alwaysShowLabel) 1f else animationProgress() } .padding(horizontal = NavigationBarItemHorizontalPadding / 2) ) { label() } } }) { measurables, constraints -> @Suppress("NAME_SHADOWING") val animationProgress = animationProgress() val looseConstraints = constraints.copy(minWidth = 0, minHeight = 0) val iconPlaceable = measurables.fastFirst { it.layoutId == IconLayoutIdTag }.measure(looseConstraints) val totalIndicatorWidth = iconPlaceable.width + (IndicatorHorizontalPadding * 2).roundToPx() val animatedIndicatorWidth = (totalIndicatorWidth * animationProgress).roundToInt() val indicatorHeight = iconPlaceable.height + (IndicatorVerticalPadding * 2).roundToPx() val indicatorRipplePlaceable = measurables .fastFirst { it.layoutId == IndicatorRippleLayoutIdTag } .measure( Constraints.fixed( width = totalIndicatorWidth, height = indicatorHeight ) ) val indicatorPlaceable = measurables .fastFirstOrNull { it.layoutId == IndicatorLayoutIdTag } ?.measure( Constraints.fixed( width = animatedIndicatorWidth, height = indicatorHeight ) ) val labelPlaceable = label?.let { measurables .fastFirst { it.layoutId == LabelLayoutIdTag } .measure(looseConstraints) } if (label == null) { placeIcon(iconPlaceable, indicatorRipplePlaceable, indicatorPlaceable, constraints) } else { placeLabelAndIcon( labelPlaceable!!, iconPlaceable, indicatorRipplePlaceable, indicatorPlaceable, constraints, alwaysShowLabel, animationProgress ) } } } /** * Places the provided [Placeable]s in the center of the provided [constraints]. */ private fun MeasureScope.placeIcon( iconPlaceable: Placeable, indicatorRipplePlaceable: Placeable, indicatorPlaceable: Placeable?, constraints: Constraints ): MeasureResult { val width = constraints.maxWidth val height = constraints.constrainHeight(NavigationBarHeight.roundToPx()) val iconX = (width - iconPlaceable.width) / 2 val iconY = (height - iconPlaceable.height) / 2 val rippleX = (width - indicatorRipplePlaceable.width) / 2 val rippleY = (height - indicatorRipplePlaceable.height) / 2 return layout(width, height) { indicatorPlaceable?.let { val indicatorX = (width - it.width) / 2 val indicatorY = (height - it.height) / 2 it.placeRelative(indicatorX, indicatorY) } iconPlaceable.placeRelative(iconX, iconY) indicatorRipplePlaceable.placeRelative(rippleX, rippleY) } } /** * Places the provided [Placeable]s in the correct position, depending on [alwaysShowLabel] and * [animationProgress]. * * When [alwaysShowLabel] is true, the positions do not move. The [iconPlaceable] and * [labelPlaceable] will be placed together in the center with padding between them, according to * the spec. * * When [animationProgress] is 1 (representing the selected state), the positions will be the same * as above. * * Otherwise, when [animationProgress] is 0, [iconPlaceable] will be placed in the center, like in * [placeIcon], and [labelPlaceable] will not be shown. * * When [animationProgress] is animating between these values, [iconPlaceable] and [labelPlaceable] * will be placed at a corresponding interpolated position. * * [indicatorRipplePlaceable] and [indicatorPlaceable] will always be placed in such a way that to * share the same center as [iconPlaceable]. * * @param labelPlaceable text label placeable inside this item * @param iconPlaceable icon placeable inside this item * @param indicatorRipplePlaceable indicator ripple placeable inside this item * @param indicatorPlaceable indicator placeable inside this item, if it exists * @param constraints constraints of the item * @param alwaysShowLabel whether to always show the label for this item. If true, icon and label * positions will not change. If false, positions transition between 'centered icon with no label' * and 'top aligned icon with label'. * @param animationProgress progress of the animation, where 0 represents the unselected state of * this item and 1 represents the selected state. Values between 0 and 1 interpolate positions of * the icon and label. */ private fun MeasureScope.placeLabelAndIcon( labelPlaceable: Placeable, iconPlaceable: Placeable, indicatorRipplePlaceable: Placeable, indicatorPlaceable: Placeable?, constraints: Constraints, alwaysShowLabel: Boolean, animationProgress: Float, ): MeasureResult { val contentHeight = iconPlaceable.height + IndicatorVerticalPadding.toPx() + NavigationBarIndicatorToLabelPadding.toPx() + labelPlaceable.height val contentVerticalPadding = ((constraints.minHeight - contentHeight) / 2) .coerceAtLeast(IndicatorVerticalPadding.toPx()) val height = contentHeight + contentVerticalPadding * 2 // Icon (when selected) should be `contentVerticalPadding` from top val selectedIconY = contentVerticalPadding val unselectedIconY = if (alwaysShowLabel) selectedIconY else (height - iconPlaceable.height) / 2 // How far the icon needs to move between unselected and selected states. val iconDistance = unselectedIconY - selectedIconY // The interpolated fraction of iconDistance that all placeables need to move based on // animationProgress. val offset = iconDistance * (1 - animationProgress) // Label should be fixed padding below icon val labelY = selectedIconY + iconPlaceable.height + IndicatorVerticalPadding.toPx() + NavigationBarIndicatorToLabelPadding.toPx() val containerWidth = constraints.maxWidth val labelX = (containerWidth - labelPlaceable.width) / 2 val iconX = (containerWidth - iconPlaceable.width) / 2 val rippleX = (containerWidth - indicatorRipplePlaceable.width) / 2 val rippleY = selectedIconY - IndicatorVerticalPadding.toPx() return layout(containerWidth, height.roundToInt()) { indicatorPlaceable?.let { val indicatorX = (containerWidth - it.width) / 2 val indicatorY = selectedIconY - IndicatorVerticalPadding.roundToPx() it.placeRelative(indicatorX, (indicatorY + offset).roundToInt()) } if (alwaysShowLabel || animationProgress != 0f) { labelPlaceable.placeRelative(labelX, (labelY + offset).roundToInt()) } iconPlaceable.placeRelative(iconX, (selectedIconY + offset).roundToInt()) indicatorRipplePlaceable.placeRelative(rippleX, (rippleY + offset).roundToInt()) } } private const val IndicatorRippleLayoutIdTag: String = "indicatorRipple" private const val IndicatorLayoutIdTag: String = "indicator" private const val IconLayoutIdTag: String = "icon" private const val LabelLayoutIdTag: String = "label" private val NavigationBarHeight: Dp = NavigationBarTokens.ContainerHeight private const val ItemAnimationDurationMillis: Int = 100 /*@VisibleForTesting*/ internal val NavigationBarItemHorizontalPadding: Dp = 8.dp /*@VisibleForTesting*/ internal val NavigationBarIndicatorToLabelPadding: Dp = 4.dp private val IndicatorHorizontalPadding: Dp = (NavigationBarTokens.ActiveIndicatorWidth - NavigationBarTokens.IconSize) / 2 /*@VisibleForTesting*/ internal val IndicatorVerticalPadding: Dp = (NavigationBarTokens.ActiveIndicatorHeight - NavigationBarTokens.IconSize) / 2 private val IndicatorVerticalOffset: Dp = 12.dp