ColorScheme constructor
- required Brightness brightness,
- required Color primary,
- required Color onPrimary,
- Color? primaryContainer,
- Color? onPrimaryContainer,
- Color? primaryFixed,
- Color? primaryFixedDim,
- Color? onPrimaryFixed,
- Color? onPrimaryFixedVariant,
- required Color secondary,
- required Color onSecondary,
- Color? secondaryContainer,
- Color? onSecondaryContainer,
- Color? secondaryFixed,
- Color? secondaryFixedDim,
- Color? onSecondaryFixed,
- Color? onSecondaryFixedVariant,
- Color? tertiary,
- Color? onTertiary,
- Color? tertiaryContainer,
- Color? onTertiaryContainer,
- Color? tertiaryFixed,
- Color? tertiaryFixedDim,
- Color? onTertiaryFixed,
- Color? onTertiaryFixedVariant,
- required Color error,
- required Color onError,
- Color? errorContainer,
- Color? onErrorContainer,
- required Color surface,
- required Color onSurface,
- Color? surfaceDim,
- Color? surfaceBright,
- Color? surfaceContainerLowest,
- Color? surfaceContainerLow,
- Color? surfaceContainer,
- Color? surfaceContainerHigh,
- Color? surfaceContainerHighest,
- Color? onSurfaceVariant,
- Color? outline,
- Color? outlineVariant,
- Color? shadow,
- Color? scrim,
- Color? inverseSurface,
- Color? onInverseSurface,
- Color? inversePrimary,
- Color? surfaceTint,
- @Deprecated('Use surface instead. ' 'This feature was deprecated after v3.18.0-0.1.pre.') Color? background,
- @Deprecated('Use onSurface instead. ' 'This feature was deprecated after v3.18.0-0.1.pre.') Color? onBackground,
- @Deprecated('Use surfaceContainerHighest instead. ' 'This feature was deprecated after v3.18.0-0.1.pre.') Color? surfaceVariant,
Create a ColorScheme instance from the given colors.
ColorScheme.fromSeed can be used as a simpler way to create a full color scheme derived from a single seed color.
For the color parameters that are nullable, it is still recommended that applications provide values for them. They are only nullable due to backwards compatibility concerns.
If a color is not provided, the closest fallback color from the given
colors will be used for it (e.g. primaryContainer
will default
to primary). Material Design 3 makes use of these colors for many
component defaults, so for the best results the application should
supply colors for all the parameters. An easy way to ensure this is to
use ColorScheme.fromSeed to generate a full set of colors.
During the migration to Material Design 3, if an app's ThemeData.useMaterial3 is false, then components will only use the following colors for defaults:
Implementation
const ColorScheme({
required this.brightness,
required this.primary,
required this.onPrimary,
Color? primaryContainer,
Color? onPrimaryContainer,
Color? primaryFixed,
Color? primaryFixedDim,
Color? onPrimaryFixed,
Color? onPrimaryFixedVariant,
required this.secondary,
required this.onSecondary,
Color? secondaryContainer,
Color? onSecondaryContainer,
Color? secondaryFixed,
Color? secondaryFixedDim,
Color? onSecondaryFixed,
Color? onSecondaryFixedVariant,
Color? tertiary,
Color? onTertiary,
Color? tertiaryContainer,
Color? onTertiaryContainer,
Color? tertiaryFixed,
Color? tertiaryFixedDim,
Color? onTertiaryFixed,
Color? onTertiaryFixedVariant,
required this.error,
required this.onError,
Color? errorContainer,
Color? onErrorContainer,
required this.surface,
required this.onSurface,
Color? surfaceDim,
Color? surfaceBright,
Color? surfaceContainerLowest,
Color? surfaceContainerLow,
Color? surfaceContainer,
Color? surfaceContainerHigh,
Color? surfaceContainerHighest,
Color? onSurfaceVariant,
Color? outline,
Color? outlineVariant,
Color? shadow,
Color? scrim,
Color? inverseSurface,
Color? onInverseSurface,
Color? inversePrimary,
Color? surfaceTint,
@Deprecated(
'Use surface instead. '
'This feature was deprecated after v3.18.0-0.1.pre.'
)
Color? background,
@Deprecated(
'Use onSurface instead. '
'This feature was deprecated after v3.18.0-0.1.pre.'
)
Color? onBackground,
@Deprecated(
'Use surfaceContainerHighest instead. '
'This feature was deprecated after v3.18.0-0.1.pre.'
)
Color? surfaceVariant,
}) : _primaryContainer = primaryContainer,
_onPrimaryContainer = onPrimaryContainer,
_primaryFixed = primaryFixed,
_primaryFixedDim = primaryFixedDim,
_onPrimaryFixed = onPrimaryFixed,
_onPrimaryFixedVariant = onPrimaryFixedVariant,
_secondaryContainer = secondaryContainer,
_onSecondaryContainer = onSecondaryContainer,
_secondaryFixed = secondaryFixed,
_secondaryFixedDim = secondaryFixedDim,
_onSecondaryFixed = onSecondaryFixed,
_onSecondaryFixedVariant = onSecondaryFixedVariant,
_tertiary = tertiary,
_onTertiary = onTertiary,
_tertiaryContainer = tertiaryContainer,
_onTertiaryContainer = onTertiaryContainer,
_tertiaryFixed = tertiaryFixed,
_tertiaryFixedDim = tertiaryFixedDim,
_onTertiaryFixed = onTertiaryFixed,
_onTertiaryFixedVariant = onTertiaryFixedVariant,
_errorContainer = errorContainer,
_onErrorContainer = onErrorContainer,
_surfaceDim = surfaceDim,
_surfaceBright = surfaceBright,
_surfaceContainerLowest = surfaceContainerLowest,
_surfaceContainerLow = surfaceContainerLow,
_surfaceContainer = surfaceContainer,
_surfaceContainerHigh = surfaceContainerHigh,
_surfaceContainerHighest = surfaceContainerHighest,
_onSurfaceVariant = onSurfaceVariant,
_outline = outline,
_outlineVariant = outlineVariant,
_shadow = shadow,
_scrim = scrim,
_inverseSurface = inverseSurface,
_onInverseSurface = onInverseSurface,
_inversePrimary = inversePrimary,
_surfaceTint = surfaceTint,
// DEPRECATED (newest deprecations at the bottom)
_background = background,
_onBackground = onBackground,
_surfaceVariant = surfaceVariant;