This project provides a credit card slider
Author: theboringdeveloper
CreditCard(
cardBackground: SolidColorCardBackground(Colors.red),
cardNetworkType: CardNetworkType.visaBasic,
cardHolderName: 'The boring developer',
),
- Creates a credit card with a solid background of red color
- Credit card of type visa
- Shows a card holder name
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: CreditCardSlider(
_creditCards, //List of credit cards
),
),
);
}
Use field percentOfUpperCard of CreditCardSlider
NOTE: Value must lie between 0 and pi / 2
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: CreditCardSlider(
_creditCards,
percentOfUpperCard: pi / 2,
),
),
);
}
NOTE: Added in 1.0.1
You can also specify initial card index to appear in slider
-
initialCard is 0 index based
-
If not specified, initialCard is 0
@override Widget build(BuildContext context) { return Scaffold( body: Center( child: CreditCardSlider( _creditCards, initialCard: 2, ), ), ); }
NOTE: Added in 1.0.1
You can also repeat cards in down or both direction (up and down)
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: CreditCardSlider(
_creditCards,
repeatCards: RepeatCards.down,
),
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: CreditCardSlider(
_creditCards,
repeatCards: RepeatCards.bothDirection,
),
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: CreditCardSlider(
_creditCards,
onCardClicked: (index) {
print('Clicked at index: $index');
},
),
),
);
}
- Added in 1.0.0+2
- Solid Color
- Gradient
- Image
CreditCard(
cardBackground: GradientCardBackground(LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [Color(0xFF4AA3F2), Color(0xFFAF92FB)],
stops: [0.3, 0.95],
)),
cardNetworkType: CardNetworkType.visaBasic,
cardHolderName: 'The boring developer',
)
CreditCard(
cardBackground:
ImageCardBackground(AssetImage('images/background_sample.jpg')),
cardNetworkType: CardNetworkType.rupay,
cardHolderName: 'The boring developer',
)
cardNumber field of type string
CreditCard(
cardBackground: SolidColorCardBackground(Colors.black.withOpacity(0.6)),
cardNetworkType: CardNetworkType.visaBasic,
cardHolderName: 'The boring developer',
cardNumber: '1234 1234 1234 1234',
)
CreditCard(
cardBackground: SolidColorCardBackground(Colors.black.withOpacity(0.6)),
cardNetworkType: CardNetworkType.visaBasic,
cardHolderName: 'The boring developer',
cardNumber: '1234 **** **** ****',
)
CreditCard(
cardBackground: SolidColorCardBackground(Colors.black.withOpacity(0.6)),
cardNetworkType: CardNetworkType.visaBasic,
cardHolderName: 'The boring developer',
cardNumber: '1234 **** **** ****',
company: CardCompany.hdfc,
)
CreditCard(
cardBackground: SolidColorCardBackground(Colors.black.withOpacity(0.6)),
cardNetworkType: CardNetworkType.visaBasic,
cardHolderName: 'The boring developer',
cardNumber: '1234 **** **** ****',
company: CardCompany(Image.asset(imagePath)),
)
NOTE: - List of companies available at end
NOTE: If Validity is added, valid thru must be added. Valid from is optional
CreditCard(
cardBackground: SolidColorCardBackground(Colors.purple),
cardNetworkType: CardNetworkType.visaBasic,
cardHolderName: 'The boring developer',
cardNumber: '1234 **** **** ****',
company: CardCompany.sbi,
validity: Validity(
validThruMonth: 1,
validThruYear: 21,
),
),
CreditCard(
cardBackground: SolidColorCardBackground(Colors.purple),
cardNetworkType: CardNetworkType.visaBasic,
cardHolderName: 'The boring developer',
cardNumber: '1234 **** **** ****',
company: CardCompany.sbi,
validity: Validity(
validThruMonth: 1,
validThruYear: 21,
validFromMonth: 1,
validFromYear: 16,
),
),
Set showChip to false
CreditCard(
cardBackground: SolidColorCardBackground(Colors.purple),
cardNetworkType: CardNetworkType.visaBasic,
cardHolderName: 'The boring developer',
cardNumber: '1234 **** **** ****',
company: CardCompany.sbi,
showChip: false,
validity: Validity(
validThruMonth: 1,
validThruYear: 21,
validFromMonth: 1,
validFromYear: 16,
),
),
CreditCard(
cardBackground: SolidColorCardBackground(Colors.white),
cardNetworkType: CardNetworkType.visaBasic,
cardHolderName: 'The boring developer',
cardNumber: '1234 **** **** ****',
company: CardCompany.sbi,
validity: Validity(
validThruMonth: 1,
validThruYear: 21,
validFromMonth: 1,
validFromYear: 16,
),
numberColor: Colors.black,
validityColor: Colors.black,
cardHolderNameColor: Colors.black,
),
-
American Express
company: CardCompany.americanExpress
-
AxisBank
company: CardCompany.axisBank
company: CardCompany.axisBankWhite
-
Citi Bank
company: CardCompany.citiBank
-
HDFC
-
HSBC
company: CardCompany.hsbc
-
ICICI
company: CardCompany.icici
-
INDUSLAND
company: CardCompany.indusland
-
Kotak
company: CardCompany.kotak
-
SBI
company: CardCompany.sbi
-
Virgin
company: CardCompany.virgin
-
YESBANK
company: CardCompany.yesBank