ColorTheme constructor
ColorTheme({
- String? name,
- ThemeMode? themeMode,
- ThemeColor<
Color> ? green, - ThemeColor<
Color> ? grey, - ThemeColor<
Color> ? blue, - ThemeColor<
Color> ? red, - ThemeColor<
Color> ? orange, - ThemeColor<
Color> ? yellow, - ThemeColor<
Color> ? purple, - ThemeColor<
Color> ? pink, - 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 [],
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);
}));
}
}