getTextColor function

Color getTextColor({
  1. EasyThemeType? type,
  2. bool? ghost,
  3. Color? color,
})

获取文本颜色

Implementation

Color getTextColor({
  EasyThemeType? type,
  bool? ghost,
  Color? color,
}) {
  Color textColor = iBlack;
  bool isGhost = ghost != null && ghost;
  bool isSelfColor = color != null;
  if (type == null) return isSelfColor ? (isGhost ? color : iWhite) : textColor;
  switch (type) {
    case EasyThemeType.primary:
      textColor = isGhost ? iPrimary : iWhite;
      break;
    case EasyThemeType.info:
      textColor = isGhost ? iInfo : iWhite;
      break;
    case EasyThemeType.success:
      textColor = isGhost ? iSuccess : iWhite;
      break;
    case EasyThemeType.warn:
      textColor = isGhost ? iWarn : iWhite;
      break;
    case EasyThemeType.error:
      textColor = isGhost ? iError : iWhite;
      break;
    default:
      textColor = iBlack;
      break;
  }
  return textColor;
}