Skip to content

Commit

Permalink
🐛 Applied AutoValidate and DisableAutoFillHints appropriately
Browse files Browse the repository at this point in the history
- Applied `autovalidateMode` to all `TextFormField` as per the value of `widget.autovalidateMode`.
- Fixed passing value of `autofillHints` to all `TextFormField` based on the value of `widget.disableCardNumberAutoFillHints`
  • Loading branch information
aditya-chavda authored and aditya-css committed Sep 18, 2023
1 parent dcdcab2 commit f5ae30b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# [3.0.7](https://github.com/SimformSolutionsPvtLtd/flutter_credit_card/tree/3.0.7) (Unreleased)
# [3.0.8](https://github.com/SimformSolutionsPvtLtd/flutter_credit_card/tree/3.0.8) (Unreleased)

- Fixed [#138](https://github.com/SimformSolutionsPvtLtd/flutter_credit_card/pull/148)
AutoValidateMode only applied to Card Number text field.

# [3.0.7](https://github.com/SimformSolutionsPvtLtd/flutter_credit_card/tree/3.0.7)

- Enhancement [#133](https://github.com/SimformSolutionsPvtLtd/flutter_credit_card/pull/133) Add valid thru label customization.
- Enhancement [#142](https://github.com/SimformSolutionsPvtLtd/flutter_credit_card/issues/142) Adding RuPay as card-type for users centric to India
Expand Down
23 changes: 16 additions & 7 deletions lib/credit_card_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,14 @@ class _CreditCardFormState extends State<CreditCardForm> {
color: widget.textColor,
),
decoration: widget.expiryDateDecoration,
autovalidateMode: widget.autovalidateMode,
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
autofillHints: const <String>[
AutofillHints.creditCardExpirationDate
],
autofillHints: widget.disableCardNumberAutoFillHints
? null
: const <String>[
AutofillHints.creditCardExpirationDate
],
validator: widget.expiryDateValidator ??
(String? value) {
if (value!.isEmpty) {
Expand Down Expand Up @@ -381,12 +384,15 @@ class _CreditCardFormState extends State<CreditCardForm> {
),
decoration: widget.cvvCodeDecoration,
keyboardType: TextInputType.number,
autovalidateMode: widget.autovalidateMode,
textInputAction: widget.isHolderNameVisible
? TextInputAction.next
: TextInputAction.done,
autofillHints: const <String>[
AutofillHints.creditCardSecurityCode
],
autofillHints: widget.disableCardNumberAutoFillHints
? null
: const <String>[
AutofillHints.creditCardSecurityCode
],
onChanged: (String text) {
setState(() {
cvvCode = text;
Expand Down Expand Up @@ -429,8 +435,11 @@ class _CreditCardFormState extends State<CreditCardForm> {
),
decoration: widget.cardHolderDecoration,
keyboardType: TextInputType.text,
autovalidateMode: widget.autovalidateMode,
textInputAction: TextInputAction.done,
autofillHints: const <String>[AutofillHints.creditCardName],
autofillHints: widget.disableCardNumberAutoFillHints
? null
: const <String>[AutofillHints.creditCardName],
onEditingComplete: () {
FocusScope.of(context).unfocus();
onCreditCardModelChange(creditCardModel);
Expand Down

0 comments on commit f5ae30b

Please sign in to comment.