hexColor static method
Implementation
static Color hexColor(String colorStr, {double alpha = 1}) {
int minLength = 6;
if (colorStr.length < minLength) {
return Colors.transparent;
}
if (alpha < 0) {
alpha = 0;
} else if (alpha > 1) {
alpha = 1;
}
String newColorStr = colorStr.replaceRange(0, colorStr.length - minLength, "0xFF");
Color color = Color(int.parse(newColorStr));
return Color.fromRGBO(color.red, color.green, color.blue, alpha);
}