我们的数据库将颜色另存为String“
String
Color.parseColor("#AABBCC");
Color类需要这样的东西,Color(0xFF42A5F5)所以我需要转换"#AABBCC"为0xFFAABBCC
Color(0xFF42A5F5)
"#AABBCC"
0xFFAABBCC
/// Construct a color from a hex code string, of the format #RRGGBB. Color hexToColor(String code) { return new Color(int.parse(code.substring(1, 7), radix: 16) + 0xFF000000); }