FlexSchemeColor class
Immutable color data class for the main scheme colors used in a FlexColorScheme based color scheme and theming engine.
The default constructor requires the main color properties. To make a FlexSchemeColor from a minimum of just the primary color, use the factory FlexSchemeColor.from which only requires the primary color to make a complete color set, but can use the other colors as optional values.
The FlexSchemeColor is a set of main colors, or a palette used to define a color scheme for a theme. See also FlexSchemeData that defines a name and description for a pair of matched light and dark FlexSchemeColor classes, used to make a color scheme pair, that is then used to make light and dark ThemeData, typically toggled by ThemeMode.
- Mixed in types
- Annotations
Constructors
- FlexSchemeColor({required Color primary, Color? primaryContainer, required Color secondary, Color? secondaryContainer, Color? tertiary, Color? tertiaryContainer, Color? appBarColor, Color? error, Color? errorContainer, bool swapOnMaterial3 = false})
-
Default constructor, that requires the main four colors.
const
- FlexSchemeColor.from({required Color primary, Color? primaryContainer, Color? secondary, Color? secondaryContainer, Color? tertiary, Color? tertiaryContainer, Color? appBarColor, Color? error, Color? errorContainer, Brightness? brightness, bool swapOnMaterial3 = false})
-
Make a FlexSchemeColor from just one primary color or possible also
from a more complete color scheme set. This is a convenience factory that
can create nice toned color schemes based on only the primary color.
factory
Properties
- appBarColor → Color?
-
The color of the app bar.
final
- defaultError → FlexSchemeColor
-
Return a copy of this FlexSchemeColor that will when used, result in a
theme that use the Material 3 Guide's default error and errorContainer
colors.
no setter
- error → Color?
-
The color to use for input validation errors, e.g. for
InputDecoration.errorText.
final
- errorContainer → Color?
-
A color used for error elements needing less emphasis than error.
final
- hashCode → int
-
Override for hashcode, dart.ui Jenkins based.
no setteroverride
- primary → Color
-
The color displayed most frequently across your application's screens
and components.
final
- primaryContainer → Color
-
A color used for elements needing less emphasis than primary.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- secondary → Color
-
An accent color that, when used sparingly, calls attention to parts
of your app.
final
- secondaryContainer → Color
-
A color used for elements needing less emphasis than secondary.
no setter
- swapOnMaterial3 → bool
-
When using Material3 color system, this FlexSchemeColor should prefer
to swap secondary and tertiary colors.
final
- tertiary → Color
-
A color used as a contrasting accent that can balance primary
and secondary colors or bring heightened attention to an element,
such as an input field.
no setter
- tertiaryContainer → Color
-
A private color used for elements needing less emphasis than tertiary,
no setter
Methods
-
copyWith(
{Color? primary, Color? primaryContainer, Color? secondary, Color? secondaryContainer, Color? tertiary, Color? tertiaryContainer, Color? appBarColor, Color? error, Color? errorContainer, bool? swapOnMaterial3}) → FlexSchemeColor - Copy the object with one or more provided properties changed.
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Flutter debug properties override, includes toString.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDark(
[int whiteBlend = 35, bool swapColors = false]) → FlexSchemeColor - Returns a new FlexSchemeColor instance based on this one that is suitable for dark mode.
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringShort(
) → String -
A brief description of this object, usually just the runtimeType and the
hashCode.
inherited
Operators
-
operator ==(
Object other) → bool -
Override the equality operator.
override
Static Methods
-
effective(
FlexSchemeColor colors, int usedColors, {bool swapLegacy = false, bool swapColors = false, Brightness? brightness}) → FlexSchemeColor -
Make effective FlexSchemeColor colors using 1 to 6 of the passed in
colors
based on theusedColors
property.