object NavigationDrawerItemDefaults
Contains the default values used by selectable NavigationDrawerItem
Properties
val IconSize = 24.dp
The default Icon size used by NavigationDrawerItem
val CollapsedDrawerItemWidth = 56.dp
The size of the NavigationDrawerItem when the drawer is collapsed
val ExpandedDrawerItemWidth = 256.dp
The size of the NavigationDrawerItem when the drawer is expanded
val ContainerHeightOneLine = 48.dp
The default content padding PaddingValues used by NavigationDrawerItem with 1 line when the drawer is expanded
val ContainerHeightTwoLine = 56.dp
The default content padding PaddingValues used by NavigationDrawerItem with 2 lines when the drawer is expanded
val NavigationDrawerItemElevation = Elevation.Level0
The default elevation used by NavigationDrawerItem
val ContentAnimationEnter = fadeIn() + slideIn { IntOffset(-it.width, 0) }
Animation enter default for inner content
val ContentAnimationExit = fadeOut() + slideOut { IntOffset(0, 0) }
Animation exit default for inner content
val DefaultBorder
Default border used by NavigationDrawerItem
val TrailingBadgeContainerColor
The default container color used by NavigationDrawerItem's trailing badge
val TrailingBadgeTextStyle
The default text style used by NavigationDrawerItem's trailing badge
val TrailingBadgeContentColor
The default content color used by NavigationDrawerItem's trailing badge
Functions
TrailingBadge
@Composable
fun TrailingBadge(
text: String,
containerColor: Color = TrailingBadgeContainerColor,
contentColor: Color = TrailingBadgeContentColor,
)
Creates a trailing badge for NavigationDrawerItem
shape
fun shape(
shape: Shape = RoundedCornerShape(50),
focusedShape: Shape = shape,
pressedShape: Shape = shape,
selectedShape: Shape = shape,
disabledShape: Shape = shape,
focusedSelectedShape: Shape = shape,
focusedDisabledShape: Shape = disabledShape,
pressedSelectedShape: Shape = shape,
) =
NavigationDrawerItemShape(
shape = shape,
focusedShape = focusedShape,
pressedShape = pressedShape,
selectedShape = selectedShape,
disabledShape = disabledShape,
focusedSelectedShape = focusedSelectedShape,
focusedDisabledShape = focusedDisabledShape,
pressedSelectedShape = pressedSelectedShape,
)
Creates a NavigationDrawerItemShape that represents the default container shapes used in a selectable NavigationDrawerItem
Parameters
| shape | the default shape used when the NavigationDrawerItem is enabled |
| focusedShape | the shape used when the NavigationDrawerItem is enabled and focused |
| pressedShape | the shape used when the NavigationDrawerItem is enabled and pressed |
| selectedShape | the shape used when the NavigationDrawerItem is enabled and selected |
| disabledShape | the shape used when the NavigationDrawerItem is not enabled |
| focusedSelectedShape | the shape used when the NavigationDrawerItem is enabled, focused and selected |
| focusedDisabledShape | the shape used when the NavigationDrawerItem is not enabled and focused |
| pressedSelectedShape | the shape used when the NavigationDrawerItem is enabled, pressed and selected |
colors
@ReadOnlyComposable
@Composable
fun colors(
containerColor: Color = Color.Transparent,
contentColor: Color = MaterialTheme.colorScheme.onSurface,
inactiveContentColor: Color = contentColor.copy(alpha = 0.4f),
focusedContainerColor: Color = MaterialTheme.colorScheme.inverseSurface,
focusedContentColor: Color = contentColorFor(focusedContainerColor),
pressedContainerColor: Color = focusedContainerColor,
pressedContentColor: Color = contentColorFor(focusedContainerColor),
selectedContainerColor: Color =
MaterialTheme.colorScheme.secondaryContainer.copy(alpha = 0.4f),
selectedContentColor: Color = MaterialTheme.colorScheme.onSecondaryContainer,
disabledContainerColor: Color = Color.Transparent,
disabledContentColor: Color = MaterialTheme.colorScheme.onSurface,
disabledInactiveContentColor: Color = disabledContentColor.copy(alpha = 0.4f),
focusedSelectedContainerColor: Color = focusedContainerColor,
focusedSelectedContentColor: Color = focusedContentColor,
pressedSelectedContainerColor: Color = pressedContainerColor,
pressedSelectedContentColor: Color = pressedContentColor,
) =
NavigationDrawerItemColors(
containerColor = containerColor,
contentColor = contentColor,
inactiveContentColor = inactiveContentColor,
focusedContainerColor = focusedContainerColor,
focusedContentColor = focusedContentColor,
pressedContainerColor = pressedContainerColor,
pressedContentColor = pressedContentColor,
selectedContainerColor = selectedContainerColor,
selectedContentColor = selectedContentColor,
disabledContainerColor = disabledContainerColor,
disabledContentColor = disabledContentColor,
disabledInactiveContentColor = disabledInactiveContentColor,
focusedSelectedContainerColor = focusedSelectedContainerColor,
focusedSelectedContentColor = focusedSelectedContentColor,
pressedSelectedContainerColor = pressedSelectedContainerColor,
pressedSelectedContentColor = pressedSelectedContentColor,
)
Creates a NavigationDrawerItemColors that represents the default container & content colors used in a selectable NavigationDrawerItem
Parameters
| containerColor | the default container color used when the NavigationDrawerItem is enabled |
| contentColor | the default content color used when the NavigationDrawerItem is enabled |
| inactiveContentColor | the content color used when none of the navigation items have focus |
| focusedContainerColor | the container color used when the NavigationDrawerItem is enabled and focused |
| focusedContentColor | the content color used when the NavigationDrawerItem is enabled and focused |
| pressedContainerColor | the container color used when the NavigationDrawerItem is enabled and pressed |
| pressedContentColor | the content color used when the NavigationDrawerItem is enabled and pressed |
| selectedContainerColor | the container color used when the NavigationDrawerItem is enabled and selected |
| selectedContentColor | the content color used when the NavigationDrawerItem is enabled and selected |
| disabledContainerColor | the container color used when the NavigationDrawerItem is not enabled |
| disabledContentColor | the content color used when the NavigationDrawerItem is not enabled |
| disabledInactiveContentColor | the content color used when none of the navigation items have focus and this item is disabled |
| focusedSelectedContainerColor | the container color used when the NavigationDrawerItem is enabled, focused and selected |
| focusedSelectedContentColor | the content color used when the NavigationDrawerItem is enabled, focused and selected |
| pressedSelectedContainerColor | the container color used when the NavigationDrawerItem is enabled, pressed and selected |
| pressedSelectedContentColor | the content color used when the NavigationDrawerItem is enabled, pressed and selected |
scale
fun scale(
@FloatRange(from = 0.0) scale: Float = 1f,
@FloatRange(from = 0.0) focusedScale: Float = 1.05f,
@FloatRange(from = 0.0) pressedScale: Float = scale,
@FloatRange(from = 0.0) selectedScale: Float = scale,
@FloatRange(from = 0.0) disabledScale: Float = scale,
@FloatRange(from = 0.0) focusedSelectedScale: Float = focusedScale,
@FloatRange(from = 0.0) focusedDisabledScale: Float = disabledScale,
@FloatRange(from = 0.0) pressedSelectedScale: Float = scale,
) =
NavigationDrawerItemScale(
scale = scale,
focusedScale = focusedScale,
pressedScale = pressedScale,
selectedScale = selectedScale,
disabledScale = disabledScale,
focusedSelectedScale = focusedSelectedScale,
focusedDisabledScale = focusedDisabledScale,
pressedSelectedScale = pressedSelectedScale,
)
Creates a NavigationDrawerItemScale that represents the default scales used in a selectable NavigationDrawerItem
scales are used to modify the size of a composable in different Interaction states e.g. 1f (original) in default state, 1.2f (scaled up) in focused state, 0.8f (scaled down) in pressed state, etc.
Parameters
| scale | the scale used when the NavigationDrawerItem is enabled |
| focusedScale | the scale used when the NavigationDrawerItem is enabled and focused |
| pressedScale | the scale used when the NavigationDrawerItem is enabled and pressed |
| selectedScale | the scale used when the NavigationDrawerItem is enabled and selected |
| disabledScale | the scale used when the NavigationDrawerItem is not enabled |
| focusedSelectedScale | the scale used when the NavigationDrawerItem is enabled, focused and selected |
| focusedDisabledScale | the scale used when the NavigationDrawerItem is not enabled and focused |
| pressedSelectedScale | the scale used when the NavigationDrawerItem is enabled, pressed and selected |
border
@ReadOnlyComposable
@Composable
fun border(
border: Border = Border.None,
focusedBorder: Border = border,
pressedBorder: Border = focusedBorder,
selectedBorder: Border = border,
disabledBorder: Border = border,
focusedSelectedBorder: Border = focusedBorder,
focusedDisabledBorder: Border = DefaultBorder,
pressedSelectedBorder: Border = border,
) =
NavigationDrawerItemBorder(
border = border,
focusedBorder = focusedBorder,
pressedBorder = pressedBorder,
selectedBorder = selectedBorder,
disabledBorder = disabledBorder,
focusedSelectedBorder = focusedSelectedBorder,
focusedDisabledBorder = focusedDisabledBorder,
pressedSelectedBorder = pressedSelectedBorder,
)
Creates a NavigationDrawerItemBorder that represents the default Borders applied on a selectable NavigationDrawerItem in different Interaction states
Parameters
| border | the default Border used when the NavigationDrawerItem is enabled |
| focusedBorder | the Border used when the NavigationDrawerItem is enabled and focused |
| pressedBorder | the Border used when the NavigationDrawerItem is enabled and pressed |
| selectedBorder | the Border used when the NavigationDrawerItem is enabled and selected |
| disabledBorder | the Border used when the NavigationDrawerItem is not enabled |
| focusedSelectedBorder | the Border used when the NavigationDrawerItem is enabled, focused and selected |
| focusedDisabledBorder | the Border used when the NavigationDrawerItem is not enabled and focused |
| pressedSelectedBorder | the Border used when the NavigationDrawerItem is enabled, pressed and selected |
glow
fun glow(
glow: Glow = Glow.None,
focusedGlow: Glow = glow,
pressedGlow: Glow = glow,
selectedGlow: Glow = glow,
focusedSelectedGlow: Glow = focusedGlow,
pressedSelectedGlow: Glow = glow,
) =
NavigationDrawerItemGlow(
glow = glow,
focusedGlow = focusedGlow,
pressedGlow = pressedGlow,
selectedGlow = selectedGlow,
focusedSelectedGlow = focusedSelectedGlow,
pressedSelectedGlow = pressedSelectedGlow,
)
Creates a NavigationDrawerItemGlow that represents the default Glows used in a selectable NavigationDrawerItem
Parameters
| glow | the Glow used when the NavigationDrawerItem is enabled, and has no other Interactions |
| focusedGlow | the Glow used when the NavigationDrawerItem is enabled and focused |
| pressedGlow | the Glow used when the NavigationDrawerItem is enabled and pressed |
| selectedGlow | the Glow used when the NavigationDrawerItem is enabled and selected |
| focusedSelectedGlow | the Glow used when the NavigationDrawerItem is enabled, focused and selected |
| pressedSelectedGlow | the Glow used when the NavigationDrawerItem is enabled, pressed and selected |