statusColor method
Returns the color associated with a status value.
Implementation
Color statusColor(
String actualValue, {
ThemeModeType? mode,
Color? fallback,
}) {
final targetMode = mode ?? _config.mode;
final status = _config.statuses
.where((item) => item.actualValue == actualValue)
.firstOrNull;
if (status == null) {
return fallback ?? Colors.transparent;
}
final colorValue = targetMode == ThemeModeType.dark
? _config.dark[status.colorTokenKey]
: _config.light[status.colorTokenKey];
if (colorValue == null) {
return fallback ?? Colors.transparent;
}
return Color(colorValue);
}