FlexColorScheme constructor

const FlexColorScheme({
  1. required Brightness brightness,
  2. required Color primary,
  3. required Color primaryVariant,
  4. required Color secondary,
  5. required Color secondaryVariant,
  6. Color? surface,
  7. Color? background,
  8. Color? error,
  9. Color? scaffoldBackground,
  10. Color? appBarBackground,
  11. Color? accentColor,
  12. Color? onPrimary,
  13. Color? onSecondary,
  14. Color? onSurface,
  15. Color? onBackground,
  16. Color? onError,
  17. FlexTabBarStyle tabBarStyle = FlexTabBarStyle.forAppBar,
  18. double appBarElevation = 0,
  19. double bottomAppBarElevation = 0,
  20. bool tooltipsMatchBackground = false,
  21. bool transparentStatusBar = true,
  22. VisualDensity? visualDensity,
  23. String? fontFamily,
  24. TargetPlatform? platform,
  25. Typography? typography,
})

Default constructor that requires its key color properties in order to make a fully designed color scheme for a ThemeData object.

It can be tedious to define nice color scheme directly with this default constructor. FlexColorScheme is primarily intended to be used with its two factory constructors FlexColorScheme.light and FlexColorScheme.dark that can create nice schemes using defaults and computed color values, from only a primary scheme color.

The factories also contain additional properties that can be used to create branded surface colors, toggle the AppBarTheme between a few styles and to make dark themes that uses true black background and surfaces.

Implementation

const FlexColorScheme({
  required this.brightness,
  required this.primary,
  required this.primaryVariant,
  required this.secondary,
  required this.secondaryVariant,
  this.surface,
  this.background,
  this.error,
  this.scaffoldBackground,
  this.appBarBackground,
  this.accentColor,
  this.onPrimary,
  this.onSecondary,
  this.onSurface,
  this.onBackground,
  this.onError,
  this.tabBarStyle = FlexTabBarStyle.forAppBar,
  this.appBarElevation = 0,
  this.bottomAppBarElevation = 0,
  this.tooltipsMatchBackground = false,
  this.transparentStatusBar = true,
  this.visualDensity,
  this.fontFamily,
  this.platform,
  this.typography,
})  : assert(appBarElevation >= 0.0, 'AppBar elevation must be >= 0.'),
      assert(bottomAppBarElevation >= 0.0,
          'Bottom AppBar elevation must be >= 0.');