getButtonBackgroundColor function

Color getButtonBackgroundColor(
  1. EasyButtonType? type,
  2. bool? ghost
)

获取按钮的背景颜色

Implementation

Color getButtonBackgroundColor(EasyButtonType? type, bool? ghost) {
  bool isGhost = ghost != null && ghost;
  if (isGhost) return iTransparent;
  Color bgColor = iWhite;
  if (type == null) return bgColor;
  switch (type) {
    case EasyButtonType.primary:
      bgColor = iPrimary;
      break;
    case EasyButtonType.info:
      bgColor = iInfo;
      break;
    case EasyButtonType.success:
      bgColor = iSuccess;
      break;
    case EasyButtonType.warn:
      bgColor = iWarn;
      break;
    case EasyButtonType.error:
      bgColor = iError;
      break;
    case EasyButtonType.text:
      bgColor = iWhite;
      break;
  }
  return bgColor;
}