MenuItemColors
Represents the text and icon colors used in a menu item at different states.
MenuItemColors
class MenuItemColors
@ExperimentalMaterial3ExpressiveApi
constructor(
val textColor: Color,
val leadingIconColor: Color,
val trailingIconColor: Color,
val disabledTextColor: Color,
val disabledLeadingIconColor: Color,
val disabledTrailingIconColor: Color,
containerColor: Color,
disabledContainerColor: Color,
selectedTextColor: Color,
selectedLeadingIconColor: Color,
selectedTrailingIconColor: Color,
selectedContainerColor: Color,
)
Represents the text and icon colors used in a menu item at different states.
Parameters
| textColor | the text color of this DropdownMenuItemContent when enabled |
| leadingIconColor | the leading icon color of this DropdownMenuItemContent when enabled |
| trailingIconColor | the trailing icon color of this DropdownMenuItemContent when enabled |
| disabledTextColor | the text color of this DropdownMenuItemContent when not enabled |
| disabledLeadingIconColor | the leading icon color of this DropdownMenuItemContent when not enabled |
| disabledTrailingIconColor | the trailing icon color of this DropdownMenuItemContent when not enabled |
| containerColor | the container color of this menu item when enabled and unselected |
| disabledContainerColor | the container color of this menu item when not enabled |
| selectedTextColor | the text color of this menu item when enabled and selected |
| selectedContainerColor | the container color of this menu item when enabled and selected |
| selectedLeadingIconColor | the leading icon color of this menu item when enabled and selected |
| selectedTrailingIconColor | the trailing icon color of this menu item when enabled and selected |
Secondary Constructors
constructor(
textColor: Color,
leadingIconColor: Color,
trailingIconColor: Color,
disabledTextColor: Color,
disabledLeadingIconColor: Color,
disabledTrailingIconColor: Color,
) : this(
textColor = textColor,
leadingIconColor = leadingIconColor,
trailingIconColor = trailingIconColor,
disabledTextColor = disabledTextColor,
disabledLeadingIconColor = disabledLeadingIconColor,
disabledTrailingIconColor = disabledTrailingIconColor,
containerColor = Color.Unspecified,
disabledContainerColor = Color.Unspecified,
selectedTextColor = Color.Unspecified,
selectedLeadingIconColor = Color.Unspecified,
selectedTrailingIconColor = Color.Unspecified,
selectedContainerColor = Color.Unspecified,
)
Creates an instance with colors for a standard menu item.
This constructor is used for DropdownMenuItem.
Parameters
| textColor | the text color of this menu item when enabled |
| leadingIconColor | the leading icon color of this menu item when enabled |
| trailingIconColor | the trailing icon color of this menu item when enabled |
| disabledTextColor | the text color of this menu item when not enabled |
| disabledLeadingIconColor | the leading icon color of this menu item when not enabled |
| disabledTrailingIconColor | the trailing icon color of this menu item when not enabled |
Properties
@ExperimentalMaterial3ExpressiveApi val : Color
The container color of this menu item when enabled and unselected.
@ExperimentalMaterial3ExpressiveApi val disabledContainerColor = disabledContainerColor
The container color of this menu item when not enabled
@ExperimentalMaterial3ExpressiveApi val : Color
The container color of this menu item when enabled and selected.
@ExperimentalMaterial3ExpressiveApi val : Color
The text color of this menu item when enabled and selected.
@ExperimentalMaterial3ExpressiveApi
val : Color
The leading icon color of this menu item when enabled and selected.
@ExperimentalMaterial3ExpressiveApi
val : Color
The trailing icon color of this menu item when enabled and selected.
Functions
@ExperimentalMaterial3ExpressiveApi
fun copy(
textColor: Color = this.textColor,
containerColor: Color = this.containerColor,
leadingIconColor: Color = this.leadingIconColor,
trailingIconColor: Color = this.trailingIconColor,
disabledTextColor: Color = this.disabledTextColor,
disabledContainerColor: Color = this.disabledContainerColor,
disabledLeadingIconColor: Color = this.disabledLeadingIconColor,
disabledTrailingIconColor: Color = this.disabledTrailingIconColor,
selectedTextColor: Color = this.selectedTextColor,
selectedContainerColor: Color = this.selectedContainerColor,
selectedLeadingIconColor: Color = this.selectedLeadingIconColor,
selectedTrailingIconColor: Color = this.selectedTrailingIconColor,
) =
MenuItemColors(
textColor.takeOrElse { this.textColor },
leadingIconColor.takeOrElse { this.leadingIconColor },
trailingIconColor.takeOrElse { this.trailingIconColor },
disabledTextColor.takeOrElse { this.disabledTextColor },
disabledLeadingIconColor.takeOrElse { this.disabledLeadingIconColor },
disabledTrailingIconColor.takeOrElse { this.disabledTrailingIconColor },
containerColor.takeOrElse { this.containerColor },
disabledContainerColor.takeOrElse { this.disabledContainerColor },
selectedTextColor.takeOrElse { this.selectedTextColor },
selectedLeadingIconColor.takeOrElse { this.selectedLeadingIconColor },
selectedTrailingIconColor.takeOrElse { this.selectedTrailingIconColor },
selectedContainerColor.takeOrElse { this.selectedContainerColor },
)
Returns a copy of this MenuItemColors, optionally overriding some of the values. This uses the Color.Unspecified to mean “use the value from the source”
fun copy(
textColor: Color = this.textColor,
leadingIconColor: Color = this.leadingIconColor,
trailingIconColor: Color = this.trailingIconColor,
disabledTextColor: Color = this.disabledTextColor,
disabledLeadingIconColor: Color = this.disabledLeadingIconColor,
disabledTrailingIconColor: Color = this.disabledTrailingIconColor,
) =
MenuItemColors(
textColor.takeOrElse { this.textColor },
leadingIconColor.takeOrElse { this.leadingIconColor },
trailingIconColor.takeOrElse { this.trailingIconColor },
disabledTextColor.takeOrElse { this.disabledTextColor },
disabledLeadingIconColor.takeOrElse { this.disabledLeadingIconColor },
disabledTrailingIconColor.takeOrElse { this.disabledTrailingIconColor },
)
Returns a copy of this MenuItemColors, optionally overriding some of the values. This uses the Color.Unspecified to mean “use the value from the source”