Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a key to the form. #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/credit_card_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class CreditCardForm extends StatefulWidget {
this.themeColor,
this.textColor = Colors.black,
this.cursorColor,
this.formKey
}) : super(key: key);

final String cardNumber;
Expand All @@ -24,6 +25,7 @@ class CreditCardForm extends StatefulWidget {
final Color themeColor;
final Color textColor;
final Color cursorColor;
final var formKey = GlobalKey<FormState>();

@override
_CreditCardFormState createState() => _CreditCardFormState();
Expand Down Expand Up @@ -65,7 +67,8 @@ class _CreditCardFormState extends State<CreditCardForm> {
creditCardModel = CreditCardModel(
cardNumber, expiryDate, cardHolderName, cvvCode, isCvvFocused);
}


get getFormKey => formKey;
@override
void initState() {
super.initState();
Expand Down Expand Up @@ -123,6 +126,7 @@ class _CreditCardFormState extends State<CreditCardForm> {
primaryColorDark: themeColor,
),
child: Form(
key: formKey,
child: Column(
children: <Widget>[
Container(
Expand Down