FlexColorScheme constructor

const FlexColorScheme({
  1. ColorScheme? colorScheme,
  2. Brightness? brightness,
  3. Color? primary,
  4. Color? primaryContainer,
  5. Color? secondary,
  6. Color? secondaryContainer,
  7. Color? tertiary,
  8. Color? tertiaryContainer,
  9. Color? error,
  10. Color? surface,
  11. Color? background,
  12. Color? scaffoldBackground,
  13. Color? dialogBackground,
  14. Color? appBarBackground,
  15. Color? onPrimary,
  16. Color? onPrimaryContainer,
  17. Color? onSecondary,
  18. Color? onSecondaryContainer,
  19. Color? onTertiary,
  20. Color? onTertiaryContainer,
  21. Color? onSurface,
  22. Color? onBackground,
  23. Color? onError,
  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. FlexSubThemesData? subThemesData,
  43. bool useMaterial3 = false,
  44. Iterable<ThemeExtension>? extensions,
})

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.colorScheme,
  this.brightness,
  this.primary,
  this.primaryContainer,
  this.secondary,
  this.secondaryContainer,
  this.tertiary,
  this.tertiaryContainer,
  this.error,
  this.surface,
  this.background,
  this.scaffoldBackground,
  this.dialogBackground,
  this.appBarBackground,
  this.onPrimary,
  this.onPrimaryContainer,
  this.onSecondary,
  this.onSecondaryContainer,
  this.onTertiary,
  this.onTertiaryContainer,
  this.onSurface,
  this.onBackground,
  this.onError,
  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.subThemesData,
  this.useMaterial3 = false,
  this.extensions,
})  : 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.');