Skip to content

Commit

Permalink
Proper Age Validation Added in Sign-up form additional Details
Browse files Browse the repository at this point in the history
  • Loading branch information
SamarpanCoder2002 committed Mar 30, 2021
1 parent 45037b0 commit a3da860
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/widgets/signup_form_additional_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,15 @@ class _SignUpFormAdditionalDetailsState
SizedBox(width: 20),
Flexible(
child: AuthInputField(
textInputType: TextInputType.number,
labelText: "Age",
controller: _age,
textInputAction: TextInputAction.next,
validator: (_) {
if (_course.isNotEmpty) {
return null;
}
return "Enter valid Course Name";
validator: (age) {
if (age.isNotEmpty &&
age.length == 2 &&
int.parse(age) >= 16) return null;
return "Enter Valid Age";
},
suffixIcon:
Icon(Icons.menu_book, color: Colors.white),
Expand Down

0 comments on commit a3da860

Please sign in to comment.