getColor static method
Color?
getColor({
- required Brightness? brightness,
- required Color light,
- required Color dark,
- BuildContext? context,
- Color? color,
- bool nullable = false,
nullable
可为空
color
默认颜色
Implementation
static Color? getColor({
required Brightness? brightness,
required Color light,
required Color dark,
BuildContext? context,
Color? color,
bool nullable = false,
}) {
if (!enableDark) return light;
if (color != null) return color;
if (brightness == null && nullable) return null;
var _bright = brightness ??
(context == null ? platformBrightness : Theme.of(context).brightness);
var isLight = _bright == Brightness.light;
var _color = isLight ? light : dark;
return _color;
}