FlexKeyColors constructor

const FlexKeyColors({
  1. bool useKeyColors = true,
  2. bool useSecondary = false,
  3. bool useTertiary = false,
  4. bool keepPrimary = false,
  5. bool keepSecondary = false,
  6. bool keepTertiary = false,
  7. bool keepPrimaryContainer = false,
  8. bool keepSecondaryContainer = false,
  9. bool keepTertiaryContainer = false,
})

Used to configure how key colors are used when generating a key color seeded ColorScheme for FlexColorScheme,

Use useKeyColors to enable it (enabled by default), and useSecondary and useTertiary to define if secondary and tertiary colors in active FlexColorScheme should be to seed the generated ColorScheme.

The defaults in the unnamed constructor creates a setup that is equivalent to using ColorScheme.fromSeed with primary color as key.

Primary color is always used as a key for the seed generate tonal palettes when seed generated ColorScheme is used in FlexColorScheme.

You can also use the secondary and tertiary colors as key to generate their tonal palettes, this is not possible with Flutter SDK's ColorScheme.from Material Design 3 based constructor.

The property useKeyColors will if set to false disable using seed generated ColorScheme, even if you pass a FlexKeyColors instance to the keyColors parameter in FlexColorScheme.light or FlexColorScheme.dark factories. The property is true by default, it exists mainly for debugging and to enable easier construction of configurable toggles to enable and disable using seed generated FlexColorSchemes, while still passing in a configuration object with other properties set, that have no effect if useKeyColors is false.

Implementation

const FlexKeyColors({
  this.useKeyColors = true,
  this.useSecondary = false,
  this.useTertiary = false,
  this.keepPrimary = false,
  this.keepSecondary = false,
  this.keepTertiary = false,
  this.keepPrimaryContainer = false,
  this.keepSecondaryContainer = false,
  this.keepTertiaryContainer = false,
});