getColorCode function
Implementation
int getColorCode(String color, {int? fallback}) {
if (color.length == 10) {
return int.tryParse(color) ?? fallback ?? Colors.white.value;
}
if (color.startsWith("#")) {
return int.tryParse(color.substring(1).padLeft(8, "FF"), radix: 16) ??
fallback ??
Colors.white.value;
} else {
return int.tryParse(color.padLeft(8, "FF"), radix: 16) ??
fallback ??
Colors.white.value;
}
}