ColorSwatch<T> class
Null safety
A color that has a small table of related colors called a "swatch".
The table is indexed by values of type T
.
See also:
- MaterialColor and MaterialAccentColor, which define Material Design primary and accent color swatches.
- material.Colors, which defines all of the standard Material Design colors.
- Inheritance
- Implementers
- Annotations
Constructors
-
ColorSwatch(int primary, Map<
T, Color> _swatch) -
Creates a color that has a small table of related colors called a "swatch".
const
Properties
- alpha → int
-
The alpha channel of this color in an 8 bit value.
read-onlyinherited
- blue → int
-
The blue channel of this color in an 8 bit value.
read-onlyinherited
- green → int
-
The green channel of this color in an 8 bit value.
read-onlyinherited
- hashCode → int
-
The hash code for this object.
read-onlyoverride
- opacity → double
-
The alpha channel of this color as a double.
read-onlyinherited
- red → int
-
The red channel of this color in an 8 bit value.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
- value → int
-
A 32 bit value representing this color.
finalinherited
Methods
-
computeLuminance(
) → double -
Returns a brightness value between 0 for darkest and 1 for lightest.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
-
withAlpha(
int a) → Color -
Returns a new color that matches this color with the alpha channel
replaced with
a
(which ranges from 0 to 255).inherited -
withBlue(
int b) → Color -
Returns a new color that matches this color with the blue channel replaced
with
b
(which ranges from 0 to 255).inherited -
withGreen(
int g) → Color -
Returns a new color that matches this color with the green channel
replaced with
g
(which ranges from 0 to 255).inherited -
withOpacity(
double opacity) → Color -
Returns a new color that matches this color with the alpha channel
replaced with the given
opacity
(which ranges from 0.0 to 1.0).inherited -
withRed(
int r) → Color -
Returns a new color that matches this color with the red channel replaced
with
r
(which ranges from 0 to 255).inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
-
operator [](
T index) → Color? - Returns an element of the swatch table.
Static Methods
-
lerp<
T> (ColorSwatch< T> ? a, ColorSwatch<T> ? b, double t) → ColorSwatch<T> ? -
Linearly interpolate between two ColorSwatches.
override