SwitchColors
Class
Common
class SwitchColors
constructor(
val checkedThumbColor: Color,
val checkedTrackColor: Color,
val checkedBorderColor: Color,
val checkedIconColor: Color,
val uncheckedThumbColor: Color,
val uncheckedTrackColor: Color,
val uncheckedBorderColor: Color,
val uncheckedIconColor: Color,
val disabledCheckedThumbColor: Color,
val disabledCheckedTrackColor: Color,
val disabledCheckedBorderColor: Color,
val disabledCheckedIconColor: Color,
val disabledUncheckedThumbColor: Color,
val disabledUncheckedTrackColor: Color,
val disabledUncheckedBorderColor: Color,
val disabledUncheckedIconColor: Color,
)
Represents the colors used by a Switch
in different states
Parameters
checkedThumbColor | the color used for the thumb when enabled and checked |
checkedTrackColor | the color used for the track when enabled and checked |
checkedBorderColor | the color used for the border when enabled and checked |
checkedIconColor | the color used for the icon when enabled and checked |
uncheckedThumbColor | the color used for the thumb when enabled and unchecked |
uncheckedTrackColor | the color used for the track when enabled and unchecked |
uncheckedBorderColor | the color used for the border when enabled and unchecked |
uncheckedIconColor | the color used for the icon when enabled and unchecked |
disabledCheckedThumbColor | the color used for the thumb when disabled and checked |
disabledCheckedTrackColor | the color used for the track when disabled and checked |
disabledCheckedBorderColor | the color used for the border when disabled and checked |
disabledCheckedIconColor | the color used for the icon when disabled and checked |
disabledUncheckedThumbColor | the color used for the thumb when disabled and unchecked |
disabledUncheckedTrackColor | the color used for the track when disabled and unchecked |
disabledUncheckedBorderColor | the color used for the border when disabled and unchecked |
disabledUncheckedIconColor | the color used for the icon when disabled and unchecked |
Functions
fun copy(
checkedThumbColor: Color = this.checkedThumbColor,
checkedTrackColor: Color = this.checkedTrackColor,
checkedBorderColor: Color = this.checkedBorderColor,
checkedIconColor: Color = this.checkedIconColor,
uncheckedThumbColor: Color = this.uncheckedThumbColor,
uncheckedTrackColor: Color = this.uncheckedTrackColor,
uncheckedBorderColor: Color = this.uncheckedBorderColor,
uncheckedIconColor: Color = this.uncheckedIconColor,
disabledCheckedThumbColor: Color = this.disabledCheckedThumbColor,
disabledCheckedTrackColor: Color = this.disabledCheckedTrackColor,
disabledCheckedBorderColor: Color = this.disabledCheckedBorderColor,
disabledCheckedIconColor: Color = this.disabledCheckedIconColor,
disabledUncheckedThumbColor: Color = this.disabledUncheckedThumbColor,
disabledUncheckedTrackColor: Color = this.disabledUncheckedTrackColor,
disabledUncheckedBorderColor: Color = this.disabledUncheckedBorderColor,
disabledUncheckedIconColor: Color = this.disabledUncheckedIconColor,
) =
SwitchColors(
checkedThumbColor.takeOrElse { this.checkedThumbColor },
checkedTrackColor.takeOrElse { this.checkedTrackColor },
checkedBorderColor.takeOrElse { this.checkedBorderColor },
checkedIconColor.takeOrElse { this.checkedIconColor },
uncheckedThumbColor.takeOrElse { this.uncheckedThumbColor },
uncheckedTrackColor.takeOrElse { this.uncheckedTrackColor },
uncheckedBorderColor.takeOrElse { this.uncheckedBorderColor },
uncheckedIconColor.takeOrElse { this.uncheckedIconColor },
disabledCheckedThumbColor.takeOrElse { this.disabledCheckedThumbColor },
disabledCheckedTrackColor.takeOrElse { this.disabledCheckedTrackColor },
disabledCheckedBorderColor.takeOrElse { this.disabledCheckedBorderColor },
disabledCheckedIconColor.takeOrElse { this.disabledCheckedIconColor },
disabledUncheckedThumbColor.takeOrElse { this.disabledUncheckedThumbColor },
disabledUncheckedTrackColor.takeOrElse { this.disabledUncheckedTrackColor },
disabledUncheckedBorderColor.takeOrElse { this.disabledUncheckedBorderColor },
disabledUncheckedIconColor.takeOrElse { this.disabledUncheckedIconColor },
)
Returns a copy of this SwitchColors, optionally overriding some of the values. This uses the Color.Unspecified to mean “use the value from the source”