getCardIcon static method
Implementation
static Widget getCardIcon(CardType cardType) {
String img = "";
Icon? icon;
switch (cardType) {
case CardType.Master:
img = 'mastercard.png';
break;
case CardType.Visa:
img = 'visa.png';
break;
case CardType.Verve:
img = 'verve.png';
break;
case CardType.AmericanExpress:
img = 'american_express.png';
break;
case CardType.Discover:
img = 'discover.png';
break;
case CardType.DinersClub:
img = 'dinners_club.png';
break;
case CardType.Jcb:
img = 'jcb.png';
break;
case CardType.Others:
icon = Icon(
Icons.credit_card,
size: 40.0,
color: Colors.grey[600],
);
break;
case CardType.Invalid:
icon = Icon(
Icons.warning,
size: 40.0,
color: Colors.grey[600],
);
break;
}
Widget widget;
if (img.isNotEmpty) {
widget = Image(
image: AssetImage('assets/images/$img', package: "paystack_manager"),
width: 40.0,
);
} else {
widget = icon as Widget;
}
return widget;
}