Skip to content

Commit

Permalink
🐛 SimformSolutionsPvtLtd#40 Absence of focus node in credit_card_form…
Browse files Browse the repository at this point in the history
….dart =>

As card number is the first field so it doesn't require focus node
  • Loading branch information
meetjanani-simformsolutions authored and meetjanani committed Oct 11, 2021
1 parent 43ec16c commit 25c31c1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class MySampleState extends State<MySample> {
useBackgroundImage ? 'assets/card_bg.png' : null,
isSwipeGestureEnabled: true,
onCreditCardWidgetChange: (CreditCardBrand creditCardBrand) {},
customCardIcons: <CustomCardTypeImage>[
customCardTypeIcons: <CustomCardTypeImage>[
CustomCardTypeImage(
cardType: CardType.mastercard,
cardImage: Image.asset(
Expand Down
1 change: 0 additions & 1 deletion lib/credit_card_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ class _CreditCardFormState extends State<CreditCardForm> {
MaskedTextController(mask: '0000');

FocusNode cvvFocusNode = FocusNode();
FocusNode cardNumberNode = FocusNode();
FocusNode expiryDateNode = FocusNode();
FocusNode cardHolderNode = FocusNode();

Expand Down
14 changes: 7 additions & 7 deletions lib/credit_card_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class CreditCardWidget extends StatefulWidget {
this.glassmorphismConfig,
this.isChipVisible = true,
this.isSwipeGestureEnabled = true,
this.customCardIcons = const <CustomCardTypeImage>[],
this.customCardTypeIcons = const <CustomCardTypeImage>[],
required this.onCreditCardWidgetChange})
: super(key: key);

Expand All @@ -65,7 +65,7 @@ class CreditCardWidget extends StatefulWidget {
final String labelExpiredDate;

final CardType? cardType;
final List<CustomCardTypeImage> customCardIcons;
final List<CustomCardTypeImage> customCardTypeIcons;

@override
_CreditCardWidgetState createState() => _CreditCardWidgetState();
Expand Down Expand Up @@ -527,9 +527,9 @@ class _CreditCardWidgetState extends State<CreditCardWidget>
}

Widget getCardTypeImage(CardType? cardType) {
final List<CustomCardTypeImage> customCardImage = getCustomCardTypeIcon(cardType!);
if(customCardImage.isNotEmpty){
return customCardImage.first.cardImage;
final List<CustomCardTypeImage> customCardTypeIcon = getCustomCardTypeIcon(cardType!);
if(customCardTypeIcon.isNotEmpty){
return customCardTypeIcon.first.cardImage;
} else {
return Image.asset(
CardTypeIconAsset[cardType]!,
Expand Down Expand Up @@ -605,9 +605,9 @@ class _CreditCardWidgetState extends State<CreditCardWidget>
}

List<CustomCardTypeImage> getCustomCardTypeIcon(CardType currentCardType) =>
widget.customCardIcons
widget.customCardTypeIcons
.where((CustomCardTypeImage element) =>
element.cardType == currentCardType)
element.cardType == currentCardType)
.toList();
}

Expand Down

0 comments on commit 25c31c1

Please sign in to comment.