Skip to content

Commit f99a0be

Browse files
committed
Add checks
1 parent 4829585 commit f99a0be

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

lib/src/form_builder_validators.dart

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -581,14 +581,18 @@ class FormBuilderValidators {
581581
[
582582
FormBuilderValidators.minLength(minLength, errorText: errorText),
583583
FormBuilderValidators.maxLength(maxLength, errorText: errorText),
584-
FormBuilderValidators.hasUppercaseChars(
585-
atLeast: uppercase, errorText: errorText),
586-
FormBuilderValidators.hasLowercaseChars(
587-
atLeast: lowercase, errorText: errorText),
588-
FormBuilderValidators.hasNumericChars(
589-
atLeast: number, errorText: errorText),
590-
FormBuilderValidators.hasSpecialChars(
591-
atLeast: specialChar, errorText: errorText),
584+
if (uppercase > 0)
585+
FormBuilderValidators.hasUppercaseChars(
586+
atLeast: uppercase, errorText: errorText),
587+
if (lowercase > 0)
588+
FormBuilderValidators.hasLowercaseChars(
589+
atLeast: lowercase, errorText: errorText),
590+
if (number > 0)
591+
FormBuilderValidators.hasNumericChars(
592+
atLeast: number, errorText: errorText),
593+
if (specialChar > 0)
594+
FormBuilderValidators.hasSpecialChars(
595+
atLeast: specialChar, errorText: errorText),
592596
],
593597
);
594598
}

0 commit comments

Comments
 (0)