flutter_pw_validator 2.0.0
flutter_pw_validator: ^2.0.0 copied to clipboard
Live password rules under any TextField: a progress bar and a checklist of the rules still unmet, with Unicode-aware counting and rules you can reuse in forms.
2.0.0 #
A rewrite from scratch. Breaking changes are listed under Migration.
Added #
- The rules moved to the new dependency-free
password_rulespackage, re-exported here, so a Dart backend enforces the same policy.PasswordRulesholds the counts and any furtherPasswordRule, withvalidate(password)returning aPasswordValidation(results,isValid,failed,score,strength),formValidator()for aTextFormField, andgenerate()for a password that passes every rule. maxLength,CustomRule,CommonPasswordsRuleover the SecLists top-1000 list,MatchRulefor a confirmation field, andPasswordRules.nist()for NIST SP 800-63B-4. Each rule is aPasswordRulesubclass with its owntest.onChangedwith the full validation,strengthOfto plug an entropy estimator into the strength label,listenablesto re-check when another controller changes.barStyle: PasswordBarStyle.continuous, one track that fills with the score, and a shake whenvalidate()finds the password invalid (shakeOnInvalid).@Previewwidget previews in the example.FlutterPwValidatorStringsis now an alias ofPasswordRuleStrings;.persian()is a complete Persian set with Persian digits, andruleMetandruleNotMetserve screen readers.- Each rule row carries a semantics label, "1 digit, met", so screen readers announce the state.
- Unicode-aware counting: letters and digits from any script count, uppercase
and lowercase use Unicode categories, and a special character is anything
that is not a letter, mark, number or whitespace.
minLengthcounts user-perceived characters, so an emoji sequence counts once. - Animated state changes (
animationDuration, 200 ms by default, zero when the platform disables animations). - Filled icons by default:
radio_button_uncheckedbefore any text,check_circlefor a passing rule,cancelfor a failing one, each replaceable throughneutralIcon,successIconandfailureIcon. showStrengthLabelshows Weak, Fair, Good or Strong above the bar; the level is also available asPasswordValidation.strength.itemBuilderandbarBuilderto draw the rows or the bar yourself.textStyle,padding,spacing,barThickness,showBarandshowListparameters.- Colors default to the app theme:
colorScheme.outlinebefore any text,colorScheme.errorfor a failing rule,bodyMediumfor the labels. FlutterPwValidatorStringstakes one function per rule and one for the strength levels, so a translation can handle plurals and digit shapes.- Widget tests,
flutter_lints, a GitHub Actions workflow and pub.dev screenshots.
Fixed #
- The controller listener is removed when the widget is disposed.
- Changing
strings,rulesorcontrolleron a mounted widget is applied (issue 30). - A pre-filled controller is evaluated on first build instead of after the first keystroke.
Migration from 1.x #
minLength,normalCharCount,uppercaseCharCount,lowercaseCharCount,numericCharCountandspecialCharCountmoved intorules: PasswordRules(minLength:, letters:, uppercase:, lowercase:, digits:, special:).widthandheightare gone; the widget fills the available width and sizes its own height. Wrap it in aSizedBoxto constrain it.onSuccessis optional.- A translation is
FlutterPwValidatorStrings(uppercase: (count) => '...')instead of a subclass with"- Uppercase letter"fields. - Package files moved under
lib/src/; import onlypackage:flutter_pw_validator/flutter_pw_validator.dart. - Requires Dart 3.8 and Flutter 3.32 or newer.
1.6.0 2022-5-17 #
- New Feature: Validation for lowercase letters. Thanks to BrunoPereira
1.5.0 - 2022-12-08 #
- New Feature: Add Key property to access to the validate function (See the example)
- chore: Update gradle, kotlin, flutter version and the example app
1.4.2 - 2022-03-01 #
- New Feature: Validation for normal letters. Thanks to jeffersonmello
1.4.1 - 2022-02-10 #
- BUG FIX: setState() called after dispose(). Thanks to Money1998
1.4.0+1 - 2022-01-27 #
- Readme Updated
1.4.0 - 2022-01-27 #
- New Feature: Added an OnFail callback that gets called everytime the password doesn't match.
- Update example project
1.3.0 - 2021-10-23 #
- Support for i18n, to translate conditions. Thanks to HugoHeneault
1.2.1 - 2021-03-27 #
- Support for _ (Underscore) as special character. Thanks to adithyaakrishna
1.2.0 - 2021-03-25 #
- Sound null safety added.
1.0.1+1 - 2021-02-18 #
- README updated.
1.0.1 - 2021-02-18 #
- documents updated.
1.0.0 - 2021-02-08 #
- Initial release.
