ListItemColors
Represents the colors of a list item in different states.
ListItemColors
class ListItemColors(
val containerColor: Color,
val contentColor: Color,
val leadingContentColor: Color,
val trailingContentColor: Color,
val overlineContentColor: Color,
val supportingContentColor: Color,
val disabledContainerColor: Color,
val disabledContentColor: Color,
val disabledLeadingContentColor: Color,
val disabledTrailingContentColor: Color,
val disabledOverlineContentColor: Color,
val disabledSupportingContentColor: Color,
val selectedContainerColor: Color,
val selectedContentColor: Color,
val selectedLeadingContentColor: Color,
val selectedTrailingContentColor: Color,
val selectedOverlineContentColor: Color,
val selectedSupportingContentColor: Color,
val draggedContainerColor: Color,
val draggedContentColor: Color,
val draggedLeadingContentColor: Color,
val draggedTrailingContentColor: Color,
val draggedOverlineContentColor: Color,
val draggedSupportingContentColor: Color,
)
Represents the colors of a list item in different states.
Parameters
| containerColor | the container color of the list item. |
| contentColor | the content color of the list item. |
| leadingContentColor | the color of the leading content of the list item. |
| trailingContentColor | the color of the trailing content of the list item. |
| overlineContentColor | the color of the overline content of the list item. |
| supportingContentColor | the color of the supporting content of the list item. |
| disabledContainerColor | the container color of the list item when disabled. |
| disabledContentColor | the content color of the list item when disabled. |
| disabledLeadingContentColor | the color of the leading content of the list item when disabled. |
| disabledTrailingContentColor | the color of the trailing content of the list item when disabled. |
| disabledOverlineContentColor | the color of the overline content of the list item when disabled. |
| disabledSupportingContentColor | the color of the supporting content of the list item when disabled. |
| selectedContainerColor | the container color of the list item when selected. |
| selectedContentColor | the content color of the list item when selected. |
| selectedLeadingContentColor | the color of the leading content of the list item when selected. |
| selectedTrailingContentColor | the color of the trailing content of the list item when selected. |
| selectedOverlineContentColor | the color of the overline content of the list item when selected. |
| selectedSupportingContentColor | the color of the supporting content of the list item when selected. |
| draggedContainerColor | the container color of the list item when dragged. |
| draggedContentColor | the content color of the list item when dragged. |
| draggedLeadingContentColor | the color of the leading content of the list item when dragged. |
| draggedTrailingContentColor | the color of the trailing content of the list item when dragged. |
| draggedOverlineContentColor | the color of the overline content of the list item when dragged. |
| draggedSupportingContentColor | the color of the supporting content of the list item when dragged. |
Secondary Constructors
constructor(
containerColor: Color,
headlineColor: Color,
leadingIconColor: Color,
overlineColor: Color,
supportingTextColor: Color,
trailingIconColor: Color,
disabledHeadlineColor: Color,
disabledLeadingIconColor: Color,
disabledTrailingIconColor: Color,
) : this(
// default
containerColor = containerColor,
contentColor = headlineColor,
leadingContentColor = leadingIconColor,
trailingContentColor = trailingIconColor,
overlineContentColor = overlineColor,
supportingContentColor = supportingTextColor,
// disabled
disabledContainerColor = Color.Unspecified,
disabledContentColor = disabledHeadlineColor,
disabledLeadingContentColor = disabledLeadingIconColor,
disabledTrailingContentColor = disabledTrailingIconColor,
disabledOverlineContentColor = Color.Unspecified,
disabledSupportingContentColor = Color.Unspecified,
// selected
selectedContainerColor = Color.Unspecified,
selectedContentColor = Color.Unspecified,
selectedLeadingContentColor = Color.Unspecified,
selectedTrailingContentColor = Color.Unspecified,
selectedOverlineContentColor = Color.Unspecified,
selectedSupportingContentColor = Color.Unspecified,
// dragged
draggedContainerColor = Color.Unspecified,
draggedContentColor = Color.Unspecified,
draggedLeadingContentColor = Color.Unspecified,
draggedTrailingContentColor = Color.Unspecified,
draggedOverlineContentColor = Color.Unspecified,
draggedSupportingContentColor = Color.Unspecified,
)
Properties
Deprecated Renamed to contentColor
val headlineColor: Color
Deprecated Renamed to leadingContentColor
val leadingIconColor: Color
Deprecated Renamed to overlineContentColor
val overlineColor: Color
Deprecated Renamed to supportingContentColor
val supportingTextColor: Color
Deprecated Renamed to trailingContentColor
val trailingIconColor: Color
Deprecated Renamed to disabledContentColor
val disabledHeadlineColor: Color
Deprecated Renamed to disabledLeadingContentColor
val disabledLeadingIconColor: Color
Deprecated Renamed to disabledTrailingContentColor
val disabledTrailingIconColor: Color
Functions
fun containerColor(enabled: Boolean, selected: Boolean, dragged: Boolean): Color
Returns the container color of the list item based on the current state.
Parameters
| enabled | whether the list item is enabled. |
| selected | whether the list item is selected. |
| dragged | whether the list item is dragged. |
fun contentColor(enabled: Boolean, selected: Boolean, dragged: Boolean): Color
Returns the content color of the list item based on the current state.
Parameters
| enabled | whether the list item is enabled. |
| selected | whether the list item is selected. |
| dragged | whether the list item is dragged. |
fun leadingContentColor(enabled: Boolean, selected: Boolean, dragged: Boolean): Color
Returns the color of the leading content of the list item based on the current state.
Parameters
| enabled | whether the list item is enabled. |
| selected | whether the list item is selected. |
| dragged | whether the list item is dragged. |
fun trailingContentColor(enabled: Boolean, selected: Boolean, dragged: Boolean): Color
Returns the color of the trailing content of the list item based on the current state.
Parameters
| enabled | whether the list item is enabled. |
| selected | whether the list item is selected. |
| dragged | whether the list item is dragged. |
fun overlineContentColor(enabled: Boolean, selected: Boolean, dragged: Boolean): Color
Returns the color of the overline content of the list item based on the current state.
Parameters
| enabled | whether the list item is enabled. |
| selected | whether the list item is selected. |
| dragged | whether the list item is dragged. |
fun supportingContentColor(enabled: Boolean, selected: Boolean, dragged: Boolean): Color
Returns the color of the supporting content of the list item based on the current state.
Parameters
| enabled | whether the list item is enabled. |
| selected | whether the list item is selected. |
| dragged | whether the list item is dragged. |
fun copy(
containerColor: Color = this.containerColor,
contentColor: Color = this.contentColor,
leadingContentColor: Color = this.leadingContentColor,
trailingContentColor: Color = this.trailingContentColor,
overlineContentColor: Color = this.overlineContentColor,
supportingContentColor: Color = this.supportingContentColor,
disabledContainerColor: Color = this.disabledContainerColor,
disabledContentColor: Color = this.disabledContentColor,
disabledLeadingContentColor: Color = this.disabledLeadingContentColor,
disabledTrailingContentColor: Color = this.disabledTrailingContentColor,
disabledOverlineContentColor: Color = this.disabledOverlineContentColor,
disabledSupportingContentColor: Color = this.disabledSupportingContentColor,
selectedContainerColor: Color = this.selectedContainerColor,
selectedContentColor: Color = this.selectedContentColor,
selectedLeadingContentColor: Color = this.selectedLeadingContentColor,
selectedTrailingContentColor: Color = this.selectedTrailingContentColor,
selectedOverlineContentColor: Color = this.selectedOverlineContentColor,
selectedSupportingContentColor: Color = this.selectedSupportingContentColor,
draggedContainerColor: Color = this.draggedContainerColor,
draggedContentColor: Color = this.draggedContentColor,
draggedLeadingContentColor: Color = this.draggedLeadingContentColor,
draggedTrailingContentColor: Color = this.draggedTrailingContentColor,
draggedOverlineContentColor: Color = this.draggedOverlineContentColor,
draggedSupportingContentColor: Color = this.draggedSupportingContentColor,
): ListItemColors
Returns a copy of this ListItemColors, optionally overriding some of the values. This uses
Color.Unspecified to mean “use the value from the source”.
fun copy(
containerColor: Color = this.containerColor,
headlineColor: Color = this.headlineColor,
leadingIconColor: Color = this.leadingIconColor,
overlineColor: Color = this.overlineColor,
supportingTextColor: Color = this.supportingTextColor,
trailingIconColor: Color = this.trailingIconColor,
disabledHeadlineColor: Color = this.disabledHeadlineColor,
disabledLeadingIconColor: Color = this.disabledLeadingIconColor,
disabledTrailingIconColor: Color = this.disabledTrailingIconColor,
) =
ListItemColors(
containerColor = containerColor.takeOrElse { this.containerColor },
headlineColor = headlineColor.takeOrElse { this.headlineColor },
leadingIconColor = leadingIconColor.takeOrElse { this.leadingIconColor },
overlineColor = overlineColor.takeOrElse { this.overlineColor },
supportingTextColor = supportingTextColor.takeOrElse { this.supportingTextColor },
trailingIconColor = trailingIconColor.takeOrElse { this.trailingIconColor },
disabledHeadlineColor = disabledHeadlineColor.takeOrElse { this.disabledHeadlineColor },
disabledLeadingIconColor =
disabledLeadingIconColor.takeOrElse { this.disabledLeadingIconColor },
disabledTrailingIconColor =
disabledTrailingIconColor.takeOrElse { this.disabledTrailingIconColor },
)