ColorTheme constructor

ColorTheme({
  1. String? name,
  2. ThemeMode? themeMode,
  3. ThemeColor<Color>? green,
  4. ThemeColor<Color>? grey,
  5. ThemeColor<Color>? blue,
  6. ThemeColor<Color>? red,
  7. ThemeColor<Color>? orange,
  8. ThemeColor<Color>? yellow,
  9. ThemeColor<Color>? purple,
  10. ThemeColor<Color>? pink,
  11. ColorThemeConfig? appbar,
  12. ColorThemeConfig? base,
  13. ColorThemeConfig? background,
  14. ColorThemeConfig? bottom,
  15. ColorThemeConfig? card,
  16. ColorThemeConfig? dialog,
  17. ColorThemeConfig? divider,
  18. ColorThemeConfig? highlight,
  19. ColorThemeConfig? hint,
  20. ColorThemeConfig? hover,
  21. ColorThemeConfig? icon,
  22. ColorThemeConfig? label,
  23. ColorThemeConfig? placeholder,
  24. ColorThemeConfig? scaffold,
  25. ColorThemeConfig? shadow,
  26. ColorThemeConfig? splash,
  27. ColorThemeConfig? surface,
  28. ColorThemeConfig? text,
  29. Iterable<ColorThemeData> colors = const [],
  30. Iterable<GradientThemeData> gradients = const [],
})

Implementation

ColorTheme({
  this.name,
  ThemeMode? themeMode,
  ThemeColor? green,
  ThemeColor? grey,
  ThemeColor? blue,
  ThemeColor? red,
  ThemeColor? orange,
  ThemeColor? yellow,
  ThemeColor? purple,
  ThemeColor? pink,
  // COLORS
  ColorThemeConfig? appbar,
  ColorThemeConfig? base,
  ColorThemeConfig? background,
  ColorThemeConfig? bottom,
  ColorThemeConfig? card,
  ColorThemeConfig? dialog,
  ColorThemeConfig? divider,
  ColorThemeConfig? highlight,
  ColorThemeConfig? hint,
  ColorThemeConfig? hover,
  ColorThemeConfig? icon,
  ColorThemeConfig? label,
  ColorThemeConfig? placeholder,
  ColorThemeConfig? scaffold,
  ColorThemeConfig? shadow,
  ColorThemeConfig? splash,
  ColorThemeConfig? surface,
  ColorThemeConfig? text,
  Iterable<ColorThemeData> colors = const [],
  Iterable<GradientThemeData> gradients = const [],
})  : _themeMode = themeMode,
      _green = green,
      _grey = grey,
      _blue = blue,
      _red = red,
      _orange = orange,
      _yellow = yellow,
      _purple = purple,
      _pink = pink {
  // COLORS
  if (appbar != null) _colors[_kAppbar] = appbar;
  if (base != null) _colors[_kBase] = base;
  if (background != null) _colors[_kBackground] = background;
  if (bottom != null) _colors[_kBottom] = bottom;
  if (card != null) _colors[_kCard] = card;
  if (dialog != null) _colors[_kDialog] = dialog;
  if (divider != null) _colors[_kDivider] = divider;
  if (highlight != null) _colors[_kHighlight] = highlight;
  if (hint != null) _colors[_kHint] = hint;
  if (hover != null) _colors[_kHover] = hover;
  if (icon != null) _colors[_kIcon] = icon;
  if (label != null) _colors[_kLabel] = label;
  if (placeholder != null) _colors[_kPlaceholder] = placeholder;
  if (scaffold != null) _colors[_kScaffold] = scaffold;
  if (shadow != null) _colors[_kShadow] = shadow;
  if (splash != null) _colors[_kSplash] = splash;
  if (surface != null) _colors[_kSurface] = surface;
  if (text != null) _colors[_kText] = text;
  if (colors.isNotEmpty) {
    _customs.addEntries(colors.map((e) => MapEntry(e.name, e.config)));
  }
  if (gradients.isNotEmpty) {
    _gradients.addEntries(gradients.map((e) {
      return MapEntry(e.name, e.config);
    }));
  }
}