FlexSchemeOnColors class
Immutable data class used to create "on" colors for displaying text and icons on the surface, background, error colors and the primary and secondary colors.
Normally the on colors are not provided manually but computed by using the FlexSchemeOnColors.from static function that uses the ThemeData.estimateBrightnessForColor static function for each on color and returns a FlexSchemeOnColors object with the appropriate colors.
PrimaryVariant and SecondaryVariant do not have their own onColor. This is a limitation imposed by the Flutter SDK ColorScheme class and ThemeData using it. It is assumed that the onColor for primary and secondary colors will also work OK for their variants. This is usually correct if the variant colors are close in brightness to their none variant versions. Scaffold background color that FlexColorScheme allows us to define separately, also does not have its own "on" color, it is assumed that it is close in brightness to the background color, so it uses the same "on" color as background.
- Mixed in types
- Annotations
Constructors
- FlexSchemeOnColors({required Color onPrimary, required Color onSecondary, required Color onSurface, required Color onBackground, required Color onError})
-
Default constructor. In most situations the factory
FlexSchemeOnColors.from is the preferred way to create the onColors.
const
- FlexSchemeOnColors.from({required Color primary, required Color secondary, required Color surface, required Color background, required Color error, Color? onPrimary, Color? onSecondary, Color? onSurface, Color? onBackground, Color? onError})
-
Compute on colors for required primary, secondary, surface, background
and error colors and returns a valid FlexSchemeOnColors with correct on
colors for these colors.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- onBackground → Color
-
A color that is clearly legible when drawn on background color also used
as on color for scaffold background color.
final
- onError → Color
-
A color that is clearly legible when drawn on error color.
final
- onPrimary → Color
-
A color that is clearly legible when drawn on primary color.
final
- onSecondary → Color
-
A color that is clearly legible when drawn on secondary color.
final
- onSurface → Color
-
A color that is clearly legible when drawn on surface color.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
copyWith(
{Color? onPrimary, Color? onSecondary, Color? onSurface, Color? onBackground, Color? onError}) → FlexSchemeOnColors - Copy the object with one or more provided properties changed.
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
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 -
The equality operator.
override