Skip to content

Commit 18b0ba4

Browse files
authored
feat: Add ability to control visibility of the card masking (#28)
1 parent 11db80f commit 18b0ba4

File tree

6 files changed

+160
-122
lines changed

6 files changed

+160
-122
lines changed

CHANGELOG.md

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,113 +2,115 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
## [1.3.1] 🛠️
5+
## [1.4.0] 🔧
66

7-
### Fix
8-
9-
- Fix invisible card issue when no width is defined
10-
11-
## [1.3.0] 🛠️
12-
13-
### Deprecated parameters
7+
### Features
8+
- Added `shouldMaskCardNumber` parameter to control the masking of the card number.
149

15-
- `scale` is deprecated in 1.3.0, will be removed on later version, use width parameter instead
10+
## [1.3.1] 🐞
1611

17-
### Feature
12+
### Fixes
13+
- Resolved an issue with the card being invisible when no width is defined.
1814

19-
- Added a zoom out effect animation while card flipping.
15+
## [1.3.0] 🛑
2016

21-
## [1.2.2] 🛠️
17+
### Deprecated
18+
- `scale` parameter is deprecated and will be removed in a future version. Use the `width` parameter instead.
2219

23-
### Hot fixes
20+
### Features
2421

25-
- Workflow fixed
22+
- Introduced a zoom-out effect animation during card flipping.
2623

2724
## [1.2.1] 🛠️
2825

29-
### Hot fixes
30-
31-
- Fixed asset path warning
26+
### Hot Fixes
27+
- Resolved asset path warnings.
3228

3329
## [1.2.0] 🚀
3430

3531
### Features
3632

3733
- ✨ Added the ability to show balances and flipping animations on cards.
38-
- Introduced parameters: `showBalance`, `balance`, `cvvNumber`, `enableFlipping`, `autoHideBalance`, `disableHapticFeedback`, etc.
34+
- Introduced new parameters:
35+
- `showBalance`
36+
- `balance`
37+
- `cvvNumber`
38+
- `enableFlipping`
39+
- `autoHideBalance`
40+
- `disableHapticFeedback`
3941

4042
## [1.1.0] 🚀
4143

4244
### Features
4345

44-
- ✨ Added the ability to `showValidFrom` and `showValidThru` to hide and show the dates.
45-
- `disableShowingCardLogo` has been completely removed. To achieve the same effect, use `creditCardType: CreditCardType.none` instead.
46+
- ✨ Added `showValidFrom` and `showValidThru` parameters to control visibility of validity dates.
47+
- Removed `disableShowingCardLogo`. Use `creditCardType: CreditCardType.none` instead to achieve the same effect.
4648

4749
## [1.0.7] 🔄
4850

4951
### Features
5052

51-
- 🚀 Deprecated `disableShowingCardLogo:` property.
52-
- ✨ Added `creditCardType` to override the logo. You can now set `creditCardType: CreditCardType.none` to disable showing the card logo.
53+
- 🚀 Deprecated `disableShowingCardLogo` property.
54+
- ✨ Added `creditCardType` parameter to override the logo. Set `creditCardType: CreditCardType.none` to disable the card logo.
5355

5456
## [1.0.6] 🛠️
5557

5658
### Features
5759

58-
-Added `disableShowingCardLogo:` property to hide the card logo.
60+
-Introduced `disableShowingCardLogo` property to hide the card logo.
5961

60-
## [1.0.5] 🛠️
62+
## [1.0.5] 📝
6163

6264
### Improvements
6365

64-
- 📝 Improved the readme.
66+
- 📖 Enhanced the README documentation.
6567

66-
## [1.0.4] 🛠️
68+
## [1.0.4] 🔧
6769

6870
### Fixes
6971

7072
- 🐛 Fixed a bug with card numbers containing spaces.
7173

72-
## [1.0.3] 🛠
74+
## [1.0.3]
7375

7476
### Fixes
7577

76-
- 🐛 Made card number length flexible.
78+
- 🐛 Made the card number length flexible.
7779
- 🚀 Optimized the grouping algorithm for improved performance and accuracy.
7880

7981
## [1.0.2] 🖼️
8082

8183
### Additions
8284

83-
- 📸 Added the background image on card feature.
84-
- 🏢 Added the ability to specify the card company logo.
85-
- 🆔 Type of card can now be specified.
85+
- 📸 Added a background image feature for cards.
86+
- 🏦 Introduced the ability to specify the card company logo.
87+
- 🆔 Enabled specification of the type of card.
8688

87-
## [1.0.1] 📗
89+
## [1.0.1] 📝
8890

8991
### Additions
9092

91-
- 📝 Updated metadata.
93+
- 📖 Updated package metadata.
9294

93-
## [1.0.0+5] 👏
95+
## [1.0.0+5] 🎉
9496

9597
### Additions
9698

97-
- 📚 Updated documentation.
99+
- 📚 Enhanced documentation.
98100

99101
## [1.0.0+4] 🚀
100102

101103
### Additions
102104

103105
- 📚 Updated documentation.
104-
- 🎉 Added the new property `placeNfcIconAtTheEnd` to place the NFC icon at the opposite side of the Chip.
105-
- 💄 Correctly placed the Chip.
106+
- 🎉 Added the `placeNfcIconAtTheEnd` property to position the NFC icon at the opposite side of the Chip.
107+
- 💄 Correctly positioned the Chip on the card.
106108

107-
## [1.0.0+3] 🎉
109+
## [1.0.0+3] 🎊
108110

109111
### Additions
110112

111-
- 📸 Added an image in the `README.md` file.
113+
- 📸 Included an image in the `README.md` file.
112114

113115
## [1.0.0+2] 📝
114116

README.md

Lines changed: 46 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# uCreditCard 💳
1+
# 💳 u_credit_card: ^1.4.0
22

33
## Credit Card UI as Flutter Widget 💎
44

@@ -8,7 +8,7 @@
88
[![Code size](https://img.shields.io/github/languages/code-size/utpal-barman/u-credit-card-flutter?logo=github&logoColor=white)](https://github.com/utpal-barman/u-credit-card-flutter)
99
[![License](https://img.shields.io/github/license/utpal-barman/u-credit-card-flutter?logo=open-source-initiative&logoColor=green)](https://github.com/utpal-barman/u-credit-card-flutter/blob/main/LICENSE)
1010

11-
🔥 "uCreditCard" is a Flutter package that offers a customizable solution for showing the UI of credit cards within your app. Elevate user engagement with captivating flip animations and enhance your app's visual appeal effortlessly!
11+
🔥 **u_credit_card** is a Flutter package for creating customizable and realistic-looking credit card UI with engaging animations. Elevate the visual appeal of your app and improve user interaction effortlessly!
1212

1313
<p align="center">
1414
<img src="https://user-images.githubusercontent.com/16848599/233195178-b4fb8007-ba2e-48ed-8020-7a0854d5038c.png" width="700"/>
@@ -20,36 +20,32 @@
2020
- [Pub Package](https://pub.dev/packages/u_credit_card)
2121
- [GitHub Repository](https://github.com/utpal-barman/u-credit-card-flutter)
2222

23-
## Getting Started: Installation 💻
23+
## Installation 💻
2424

25-
**👉 To start using Credit Card UI you must have the [Flutter SDK](https://docs.flutter.dev/get-started/install) installed on your machine.**
25+
1. **Add** `u_credit_card` to your `pubspec.yaml`:
2626

27-
Add `u_credit_card` to your `pubspec.yaml`:
27+
```yaml
28+
dependencies:
29+
u_credit_card: ^1.4.0
30+
```
2831
29-
```yaml
30-
dependencies:
31-
u_credit_card: ^1.3.1
32-
```
33-
34-
Install it:
32+
2. **Install** the package:
3533
36-
```sh
37-
flutter packages get
38-
```
39-
40-
---
34+
```sh
35+
flutter packages get
36+
```
4137

4238
## Usage
4339

4440
To use the `CreditCardUi()` widget, import the package:
4541

46-
``` dart
42+
```dart
4743
import 'package:u_credit_card/u_credit_card.dart';
4844
```
4945

50-
Create widget of `CreditCardUi(...)` with the required parameters:
46+
Create a `CreditCardUi(...)` widget with the required parameters:
5147

52-
``` dart
48+
```dart
5349
CreditCardUi(
5450
cardHolderFullName: 'John Doe',
5551
cardNumber: '1234567812345678',
@@ -59,39 +55,38 @@ CreditCardUi(
5955

6056
<img width="432" alt="u_credit_card_basic_setup" src="https://user-images.githubusercontent.com/16848599/232335773-5e6fdd6e-a4d9-4c01-a202-48cbca935cbe.png">
6157

62-
This will create a credit card user interface with the cardholder's name, card number, and validity date. For more advanced usage, see the following parameters:
63-
64-
### Parameters
65-
66-
| Name | Type | Description |
67-
|-----------------------------|----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
68-
| `cardHolderFullName` | `String` | The cardholder's full name. This is a required parameter. |
69-
| `cardNumber` | `String` | The full credit card number. This is a required parameter. |
70-
| `validThru` | `String` | The validity date of the card. It must be in the format "mm/yy". This is a required parameter. |
71-
| `validFrom` | `String` | The valid from the date of the card. It must be in the format "mm/yy". This parameter is optional. |
72-
| `topLeftColor` | `Color` | The top-left gradient color of the card. The default value is `Colors.purple`. |
73-
| `bottomRightColor` | `Color` | The bottom-right gradient color of the card. If not specified, a darker version of the `topLeftColor` will be used. |
74-
| `doesSupportNfc` | `bool` | A boolean value to indicate if the card supports NFC feature. The default value is `true`. |
75-
| `placeNfcIconAtTheEnd` | `bool` | A boolean value to place the NFC icon at the opposite side of the chip. The default value is `false`. |
76-
| `cardType` | `CardType` | Specify the type of the card to display. By default, the value is set to `CardType.credit`. You can set it to `CardType.other` if you prefer not to specify a card type. This is optional. |
77-
| `creditCardType` | `CreditCardType` | Specify the type of the credit card payment network logo to display. You can set it to `CreditCardType.none` if you prefer not to specify a card type and not show on the card UI. This is optional. |
78-
| `cardProviderLogo` | `Widget` | Provide a widget for the logo of the card provider. If this parameter is not set, the card will be displayed without a logo. This is optional. |
79-
| `cardProviderLogoPosition` | `CardProviderLogoPosition` | Set the position of the card provider logo on the card. The default value is `CardProviderLogoPosition.right`. You can set it to `CardProviderLogoPosition.left` or `CardProviderLogoPosition.right`. This is optional. |
80-
| `backgroundDecorationImage` | `DecorationImage` | Set a background image for the card. This parameter supports both asset and network images. If this parameter is not set, the card will be displayed without a background image. This is optional. |
81-
| `showValidThru` | `bool` | Indicates whether to show the "Valid Thru" section on the card. If set to `false`, the "Valid Thru" section will be hidden. By default, this value is `true`. |
82-
| `showValidFrom` | `bool` | Indicates whether to show the "Valid From" section on the card. If set to `false`, the "Valid From" section will be hidden. By default, this value is `true`. |
83-
| `currencySymbol` | `String` | The symbol used to represent the currency. By default, it uses US Dollar sign ($). |
84-
| `balance` | `bool` | The balance amount. By default, this value is 0. |
85-
| `showBalance` | `bool` | A boolean flag indicating whether to show the balance. By default, this value is `false`. |
86-
| `enableFlipping` | `bool` | A boolean flag indicating whether card flipping is enabled. By default, this value is `false`. |
87-
| `autoHideBalance` | `bool` | A boolean flag indicating to enable the auto hiding balance feature. In this case, the placeholder will be shown instead of the balance. By default it is `false`.
88-
| `cvvNumber` | `bool` | CVV number of the card, use \*\*\* if you think this is sensitive, by default it will show \*\*\*. |
89-
| `disableHapticFeedBack` | `bool` | A boolean flag to disable the haptic feedback. Example — card flipping or tapping on placeholder to see balance
90-
| `width` | `double` | A double value to set the width of the card, maximum value is 300.
91-
92-
#### Example
58+
---
9359

94-
``` dart
60+
## Parameters
61+
62+
| Name | Type | Description |
63+
|-----------------------------|----------------------------|---------------------------------------------------------------------------------------------------------------------|
64+
| `cardHolderFullName` | `String` | The cardholder's full name. **Required**. |
65+
| `cardNumber` | `String` | The full credit card number. **Required**. |
66+
| `validThru` | `String` | The expiration date in "MM/YY" format. **Required**. |
67+
| `validFrom` | `String` | The "Valid From" date in "MM/YY" format. Optional. |
68+
| `topLeftColor` | `Color` | Top-left gradient color. Defaults to `Colors.purple`. |
69+
| `bottomRightColor` | `Color` | Bottom-right gradient color. Defaults to a darker shade of `topLeftColor`. |
70+
| `doesSupportNfc` | `bool` | Displays NFC icon if set to `true`. Defaults to `true`. |
71+
| `placeNfcIconAtTheEnd` | `bool` | Places NFC icon at the opposite side of the chip if set to `true`. Defaults to `false`. |
72+
| `cardType` | `CardType` | Specifies card type. Defaults to `CardType.credit`. You can set it to `CardType.other` if you prefer not to specify a card type. This is optional. |
73+
| `creditCardType` | `CreditCardType` | Specifies the credit card payment network logo. You can set it to `CreditCardType.none` if you prefer not to specify a card type and not show on the card UI. This is optional. |
74+
| `cardProviderLogo` | `Widget` | Adds a provider logo. Optional. |
75+
| `backgroundDecorationImage` | `DecorationImage` | Sets a background image. Optional. |
76+
| `showValidThru` | `bool` | Toggles "Valid Thru" section. Defaults to `true`. |
77+
| `currencySymbol` | `String` | Currency symbol. Defaults to `$`. |
78+
| `balance` | `double` | Balance amount. Defaults to `0.0`. |
79+
| `showBalance` | `bool` | Toggles the balance display. Defaults to `false`. |
80+
| `enableFlipping` | `bool` | Enables card flipping. Defaults to `false`. |
81+
| `autoHideBalance` | `bool` | Hides balance with a placeholder until tapped. Defaults to `false`. |
82+
| `cvvNumber` | `String` | CVV number shown as `***`. |
83+
| `disableHapticFeedBack` | `bool` | Disables haptic feedback on interactions. |
84+
| `width` | `double` | Width of the card, up to a max of 300. |
85+
| `shouldMaskCardNumber` | `bool` | Masks middle digits of the card number if set to `true`. Defaults to `true`. |
86+
87+
### Example
88+
89+
```dart
9590
CreditCardUi(
9691
cardHolderFullName: 'John Doe',
9792
cardNumber: '1234567812345678',
@@ -100,11 +95,8 @@ CreditCardUi(
10095
topLeftColor: Colors.blue,
10196
),
10297
```
103-
10498
<img width="432" alt="u_credit_card_nfc_basic" src="https://user-images.githubusercontent.com/16848599/232335806-159f4873-7fcb-46e0-b559-bc5a59ab61bf.png">
10599

106-
Get ready to create a sleek and stylish credit card interface with just a few lines of code! With this package, you can easily customize the cardholder's name, card number, validity dates, and gradient colors to make it uniquely yours.
107-
108100
By default, the card will have a chic blue gradient and an NFC icon. But don't worry, if you don't want the NFC icon, simply pass `doesSupportNfc: false`.
109101

110102
Want to switch things up and place the NFC icon on the opposite side of the chip? No problem! Just enable it by passing `placeNfcIconAtTheEnd: true`, but remember to also pass `doesSupportNfc: true`.
@@ -242,10 +234,6 @@ CreditCardUi(
242234

243235
---
244236

245-
## Inspiration
246-
247-
There are already many credit card packages out there, but none of them look realistic. So, I've decided to create something that will look the same as our cards in real life. Additionally, this project was inspired by a [Native Android library](https://github.com/vinaygaba/CreditCardView).
248-
249237
## Contributor
250238

251239
<a href="https://www.linkedin.com/in/utpal-barman/">

0 commit comments

Comments
 (0)