FlexColorScheme constructor

const FlexColorScheme({
  1. Brightness? brightness,
  2. ColorScheme? colorScheme,
  3. Color? primary,
  4. Color? onPrimary,
  5. Color? primaryContainer,
  6. Color? onPrimaryContainer,
  7. Color? secondary,
  8. Color? onSecondary,
  9. Color? secondaryContainer,
  10. Color? onSecondaryContainer,
  11. Color? tertiary,
  12. Color? onTertiary,
  13. Color? tertiaryContainer,
  14. Color? onTertiaryContainer,
  15. Color? error,
  16. Color? onError,
  17. Color? errorContainer,
  18. Color? onErrorContainer,
  19. Color? surface,
  20. Color? onSurface,
  21. Color? scaffoldBackground,
  22. Color? dialogBackground,
  23. Color? appBarBackground,
  24. Color? surfaceTint,
  25. FlexTabBarStyle? tabBarStyle,
  26. double? appBarElevation,
  27. double? bottomAppBarElevation,
  28. bool tooltipsMatchBackground = false,
  29. bool transparentStatusBar = true,
  30. VisualDensity? visualDensity,
  31. TextTheme? textTheme,
  32. TextTheme? primaryTextTheme,
  33. String? fontFamily,
  34. List<String>? fontFamilyFallback,
  35. String? package,
  36. MaterialTapTargetSize? materialTapTargetSize,
  37. PageTransitionsTheme? pageTransitionsTheme,
  38. InteractiveInkFeatureFactory? splashFactory,
  39. TargetPlatform? platform,
  40. Typography? typography,
  41. bool applyElevationOverlayColor = true,
  42. NoDefaultCupertinoThemeData? cupertinoOverrideTheme,
  43. FlexSubThemesData? subThemesData,
  44. bool useMaterial3 = true,
  45. Iterable<ThemeExtension>? extensions,
  46. @Deprecated('Use FlexColorScheme.surface instead. It is deprecated ' 'because Flutter 3.22 deprecated this ColorScheme color. ' 'It no longer has any function in FCS v8 and will be removed in v9.') Color? background,
  47. @Deprecated('Use FlexColorScheme.onSurface instead. It is deprecated ' 'because Flutter 3.22 deprecated this ColorScheme color. ' 'It no longer has any function in FCS v8 and will be removed in v9.') Color? onBackground,
})

Default constructor with no required properties.

Creates a a light theme by default using the M2 colors as its default theme.

Typically you would define requires brightness and four main color scheme color properties in order to make a fully defined color scheme for a ThemeData object.

For more convenient usage of FlexColorScheme consider using its two factory constructors FlexColorScheme.light and FlexColorScheme.dark, that can create schemes using defaults and computed color values, with custom overrides as needed.

The two factories also contain additional properties that can be used to create color branded surfaces, toggle the AppBarTheme between a few styles, and to make dark themes that use true black backgrounds and surfaces. As well as using FlexKeyColors and FlexTones to make and customize key color seed generated ColorSchemes.

Implementation

const FlexColorScheme({
  this.brightness,
  this.colorScheme,
  //
  this.primary,
  this.onPrimary,
  this.primaryContainer,
  this.onPrimaryContainer,
  //
  this.secondary,
  this.onSecondary,
  this.secondaryContainer,
  this.onSecondaryContainer,
  //
  this.tertiary,
  this.onTertiary,
  this.tertiaryContainer,
  this.onTertiaryContainer,
  //
  this.error,
  this.onError,
  this.errorContainer,
  this.onErrorContainer,
  //
  this.surface,
  this.onSurface,
  this.scaffoldBackground,
  this.dialogBackground,
  this.appBarBackground,
  this.surfaceTint,
  //
  this.tabBarStyle,
  this.appBarElevation,
  this.bottomAppBarElevation,
  this.tooltipsMatchBackground = false,
  this.transparentStatusBar = true,
  this.visualDensity,
  this.textTheme,
  this.primaryTextTheme,
  this.fontFamily,
  this.fontFamilyFallback,
  this.package,
  this.materialTapTargetSize,
  this.pageTransitionsTheme,
  this.splashFactory,
  this.platform,
  this.typography,
  this.applyElevationOverlayColor = true,
  this.cupertinoOverrideTheme,
  this.subThemesData,
  this.useMaterial3 = true,
  this.extensions,
  //
  @Deprecated('Use FlexColorScheme.surface instead. It is deprecated '
      'because Flutter 3.22 deprecated this ColorScheme color. '
      'It no longer has any function in FCS v8 and will be removed in v9.')
  this.background,
  @Deprecated('Use FlexColorScheme.onSurface instead. It is deprecated '
      'because Flutter 3.22 deprecated this ColorScheme color. '
      'It no longer has any function in FCS v8 and will be removed in v9.')
  this.onBackground,
})  : assert(appBarElevation == null || appBarElevation >= 0.0,
          'AppBar elevation must be >= 0 or null.'),
      assert(bottomAppBarElevation == null || bottomAppBarElevation >= 0.0,
          'Bottom AppBar elevation must be >= 0 or null.');