hexToColor function

Color hexToColor(
  1. String code
)

将字符串转换为颜色 code: 颜色代码 return: 返回flutter的颜色

Implementation

Color hexToColor(String code) {
  if (code == null) return null;
  if (code == "") return null;
  return new Color(int.parse(code.substring(1, 7), radix: 16) + 0xFF000000);
}