getCardIcon static method

Map getCardIcon(
  1. dynamic input
)

Implementation

static Map getCardIcon(input) {
  CardType cardType =
      CardUtils.getCardTypeFrmNumber(input.replaceAll(' ', ''));
  String img = "";
  double imgWidth = 30.0;
  switch (cardType) {
    case CardType.master:
      img = 'brand_mastercard.png';
      imgWidth = 40.0;
      break;
    case CardType.visa:
      img = 'brand_visa.png';
      imgWidth = 40.0;
      break;
    case CardType.americanExpress:
      img = 'brand_amex.png';
      imgWidth = 40.0;
      break;
    case CardType.discover:
      img = 'brand_discover.png';
      imgWidth = 60.0;
      break;
    case CardType.dinersClub:
      img = 'brand_diners.png';
      imgWidth = 40.0;
      break;
    case CardType.jcb:
      img = 'brand_jcb.png';
      imgWidth = 40.0;
      break;
    case CardType.mir:
      img = 'brand_mir.png';
      imgWidth = 50.0;
      break;
    case CardType.others:
      img = 'credit_card.png';
      break;
    default:
      img = 'credit_card.png';
      break;
  }
  return {"img": img, "width": imgWidth};
}