Skip to content

Commit 462bfad

Browse files
apurva010Sahil-Simform
authored andcommitted
doc: separate out readme content
1 parent 24c5a8a commit 462bfad

File tree

7 files changed

+252
-0
lines changed

7 files changed

+252
-0
lines changed

doc/advance_usage.md

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
2+
```dart
3+
CreditCardWidget(
4+
cardNumber: cardNumber,
5+
expiryDate: expiryDate,
6+
cardHolderName: cardHolderName,
7+
cvvCode: cvvCode,
8+
showBackView: isCvvFocused,
9+
onCreditCardWidgetChange: (CreditCardBrand brand) {},
10+
bankName: 'Name of the Bank',
11+
cardBgColor: Colors.black87,
12+
glassmorphismConfig: Glassmorphism.defaultConfig(),
13+
enableFloatingCard: true,
14+
floatingConfig: FloatingConfig(
15+
isGlareEnabled: true,
16+
isShadowEnabled: true,
17+
shadowConfig: FloatingShadowConfig(),
18+
),
19+
backgroundImage: 'assets/card_bg.png',
20+
backgroundNetworkImage: 'https://www.xyz.com/card_bg.png',
21+
labelValidThru: 'VALID\nTHRU',
22+
obscureCardNumber: true,
23+
obscureInitialCardNumber: false,
24+
obscureCardCvv: true,
25+
labelCardHolder: 'CARD HOLDER',
26+
labelValidThru: 'VALID\nTHRU',
27+
cardType: CardType.mastercard,
28+
isHolderNameVisible: false,
29+
height: 175,
30+
textStyle: TextStyle(color: Colors.yellowAccent),
31+
width: MediaQuery.of(context).size.width,
32+
isChipVisible: true,
33+
isSwipeGestureEnabled: true,
34+
animationDuration: Duration(milliseconds: 1000),
35+
frontCardBorder: Border.all(color: Colors.grey),
36+
backCardBorder: Border.all(color: Colors.grey),
37+
chipColor: Colors.red,
38+
padding: 16,
39+
customCardTypeIcons: <CustomCardTypeIcons>[
40+
CustomCardTypeIcons(
41+
cardType: CardType.mastercard,
42+
cardImage: Image.asset(
43+
'assets/mastercard.png',
44+
height: 48,
45+
width: 48,
46+
),
47+
),
48+
],
49+
),
50+
```
51+
52+
*Glassmorphism UI*
53+
54+
+ Default configuration
55+
```dart
56+
CreditCardWidget(
57+
glassmorphismConfig: Glassmorphism.defaultConfig(),
58+
);
59+
```
60+
61+
+ Custom configuration
62+
```dart
63+
CreditCardWidget(
64+
glassmorphismConfig: Glassmorphism(
65+
blurX: 10.0,
66+
blurY: 10.0,
67+
gradient: LinearGradient(
68+
begin: Alignment.topLeft,
69+
end: Alignment.bottomRight,
70+
colors: <Color>[
71+
Colors.grey.withAlpha(20),
72+
Colors.white.withAlpha(20),
73+
],
74+
stops: const <double>[
75+
0.3,
76+
0,
77+
],
78+
),
79+
),
80+
),
81+
```
82+
83+
*Floating Card*
84+
85+
+ Default Configuration
86+
```dart
87+
CreditCardWidget(
88+
enableFloatingCard: true,
89+
);
90+
```
91+
92+
+ Custom Configuration
93+
```dart
94+
CreditCardWidget(
95+
enableFloatingCard: true,
96+
floatingConfig: FloatingConfig(
97+
isGlareEnabled: true,
98+
isShadowEnabled: true,
99+
shadowConfig: FloatingShadowConfig(
100+
offset: Offset(10, 10),
101+
color: Colors.black84,
102+
blurRadius: 15,
103+
),
104+
),
105+
);
106+
```
107+
> NOTE: Currently the floating card animation is not supported on mobile platform browsers.
108+
109+
2. Adding CreditCardForm
110+
111+
```dart
112+
CreditCardForm(
113+
formKey: formKey, // Required
114+
cardNumber: cardNumber, // Required
115+
expiryDate: expiryDate, // Required
116+
cardHolderName: cardHolderName, // Required
117+
cvvCode: cvvCode, // Required
118+
cardNumberKey: cardNumberKey,
119+
cvvCodeKey: cvvCodeKey,
120+
expiryDateKey: expiryDateKey,
121+
cardHolderKey: cardHolderKey,
122+
onCreditCardModelChange: (CreditCardModel data) {}, // Required
123+
obscureCvv: true,
124+
obscureNumber: true,
125+
isHolderNameVisible: true,
126+
isCardNumberVisible: true,
127+
isExpiryDateVisible: true,
128+
enableCvv: true,
129+
cvvValidationMessage: 'Please input a valid CVV',
130+
dateValidationMessage: 'Please input a valid date',
131+
numberValidationMessage: 'Please input a valid number',
132+
cardNumberValidator: (String? cardNumber){},
133+
expiryDateValidator: (String? expiryDate){},
134+
cvvValidator: (String? cvv){},
135+
cardHolderValidator: (String? cardHolderName){},
136+
onFormComplete: () {
137+
// callback to execute at the end of filling card data
138+
},
139+
autovalidateMode: AutovalidateMode.always,
140+
disableCardNumberAutoFillHints: false,
141+
inputConfiguration: const InputConfiguration(
142+
cardNumberDecoration: InputDecoration(
143+
border: OutlineInputBorder(),
144+
labelText: 'Number',
145+
hintText: 'XXXX XXXX XXXX XXXX',
146+
),
147+
expiryDateDecoration: InputDecoration(
148+
border: OutlineInputBorder(),
149+
labelText: 'Expired Date',
150+
hintText: 'XX/XX',
151+
),
152+
cvvCodeDecoration: InputDecoration(
153+
border: OutlineInputBorder(),
154+
labelText: 'CVV',
155+
hintText: 'XXX',
156+
),
157+
cardHolderDecoration: InputDecoration(
158+
border: OutlineInputBorder(),
159+
labelText: 'Card Holder',
160+
),
161+
cardNumberTextStyle: TextStyle(
162+
fontSize: 10,
163+
color: Colors.black,
164+
),
165+
cardHolderTextStyle: TextStyle(
166+
fontSize: 10,
167+
color: Colors.black,
168+
),
169+
expiryDateTextStyle: TextStyle(
170+
fontSize: 10,
171+
color: Colors.black,
172+
),
173+
cvvCodeTextStyle: TextStyle(
174+
fontSize: 10,
175+
color: Colors.black,
176+
),
177+
),
178+
),
179+
```

doc/basic_usage.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
```dart
2+
CreditCardWidget(
3+
cardNumber: cardNumber,
4+
expiryDate: expiryDate,
5+
cardHolderName: cardHolderName,
6+
cvvCode: cvvCode,
7+
showBackView: isCvvFocused, //true when you want to show cvv(back) view
8+
onCreditCardWidgetChange: (CreditCardBrand brand) {}, // Callback for anytime credit card brand is changed
9+
),
10+
```

doc/contributor.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## Main Contributors
2+
3+
4+
| ![img](https://avatars.githubusercontent.com/u/25323183?v=4) | ![img](https://avatars.githubusercontent.com/u/26064415?v=4) | ![img](https://avatars.githubusercontent.com/u/30998350?v=4) | ![img](https://avatars.githubusercontent.com/u/20923896?v=4) | ![img](https://avatars.githubusercontent.com/u/32095359?v=4) |
5+
|:------------------------------------------------------------:|:-----------------------------------------------------------------:|:-------------------------------------------------------------------:|:----------------------------------------------------------------:|:------------------------------------------------------------:|
6+
| [Vatsal Tanna](https://github.com/vatsaltanna) | [Devarsh Ranpara](https://github.com/DevarshRanpara) | [Kashifa Laliwala](https://github.com/Kashifalaliwala) | [Sanket Kachchela](https://github.com/SanketKachhela) | [Meet Janani](https://github.com/meetjanani) |
7+
8+
| ![img](https://avatars.githubusercontent.com/u/63042002?v=4) | ![img](https://avatars.githubusercontent.com/u/97207242?v=4) | ![img](https://avatars.githubusercontent.com/u/56400956?v=4) | ![img](https://avatars.githubusercontent.com/u/41247722?v=4) |
9+
|:------------------------------------------------------------:|:------------------------------------------------------------:|:-------------------------------------------------------------------:|:----------------------------------------------------------------:|
10+
| [Shweta Chauhan](https://github.com/shwetachauhan-simform) | [Kavan Trivedi](https://github.com/kavantrivedi) | [Ujas Majithiya](https://github.com/Ujas-Majithiya) | [Aditya Chavda](https://github.com/aditya-chavda) |

doc/installation.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## Installing
2+
3+
1. Add dependencies to `pubspec.yaml`
4+
5+
Get the latest version in the 'Installing' tab
6+
on [pub.dev](https://pub.dev/packages/flutter_credit_card/install)
7+
8+
```yaml
9+
dependencies:
10+
flutter_credit_card: <latest-version>
11+
```
12+
13+
2. Run pub get.
14+
15+
```shell
16+
flutter pub get
17+
```
18+
19+
3. Import package.
20+
21+
```dart
22+
import 'package:flutter_credit_card/flutter_credit_card.dart';
23+
```

doc/migration_guide.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Migration guide for Version 4.x.x
2+
- The `themeColor`, `textColor`, and `cursorColor` properties have been removed from `CreditCardForm` due to changes in how it detects and applies application themes. Please check out the example app to learn how to apply those using `Theme`.
3+
- The `cardNumberDecoration`, `expiryDateDecoration`, `cvvCodeDecoration`, and `cardHolderDecoration` properties are moved to the newly added `InputDecoration` class that also has `textStyle` properties for all the textFields of the `CreditCardForm`.

doc/overview.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
![banner](https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_credit_card/master/readme_assets/banner.png)
2+
3+
# Flutter Credit Card
4+
5+
A Flutter package allows you to easily implement the Credit card's UI easily with the Card detection.
6+
7+
## Preview
8+
9+
| Glassmorphism and Card Background |
10+
|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
11+
| ![The example app showing credit card widget](https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_credit_card/master/readme_assets/preview.gif) |
12+
13+
| Floating Card on Mobile |
14+
|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
15+
| ![The example app showing card floating animation in mobile](https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_credit_card/master/readme_assets/credit_card_float_preview.gif) |
16+
17+
| Floating Card on Web |
18+
|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
19+
| ![The example app showing card floating animation in web](https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_credit_card/master/readme_assets/credit_card_float_cursor_preview.gif) |

doc/reference.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
**How to use**
2+
3+
Check out the **example** app in the [example](example) directory or the 'Example' tab on pub.dartlang.org for a more complete example.
4+
5+
## Credit
6+
7+
- This package's flip animation is inspired from this [Dribbble](https://dribbble.com/shots/2187649-Credit-card-Checkout-flow-AMEX) art.
8+
- This package's float animation is inspired from the [Motion](https://pub.dev/packages/motion) flutter package.

0 commit comments

Comments
 (0)