getCardIcon method

Widget getCardIcon(
  1. CardType cardType
)

Implementation

static Widget getCardIcon(CardType cardType) {
  String img = "";
  Icon icon;
  switch (cardType) {
    case CardType.Master:
      img = 'ic_master_card.png';
      break;
    case CardType.Visa:
      img = 'ic_visa_card.png';
      break;
    case CardType.Verve:
      img = 'verve.png';
      break;
    case CardType.AmericanExpress:
      img = 'american_express.png';
      break;
    case CardType.Discover:
      img = 'ic_discover_card.png';
      break;
    case CardType.DinersClub:
      img = 'ic_dinners_club_int_card.png';
      break;
    case CardType.Jcb:
      img = 'jcb.png';
      break;
    case CardType.Others:
      img = "ic_unknown_card.png";
      break;
    case CardType.Maestro:
      img = "ic_maestro_card.png";
      break;
    case CardType.Amex:
      img = "ic_amex_card.png";
      break;
    case CardType.Rupay:
      img = "ic_rupay_card.png";
      break;
    case CardType.Invalid:
      icon = new Icon(
        Icons.warning,
        size: 30.0,
        color: Colors.grey[600],
      );
      break;
  }
  Widget widget;
  if (img.isNotEmpty) {
    widget = Container(
        padding: EdgeInsets.symmetric(horizontal: 6),
        child: Image.asset(
          'assets/images/$img',
          width: 8,
          package: "flutter_instamojo",
        ));
  } else {
    widget = icon;
  }
  return widget;
}