ez_password_field 0.0.2 copy "ez_password_field: ^0.0.2" to clipboard
ez_password_field: ^0.0.2 copied to clipboard

A highly customizable password field with built-in visibility toggle, configurable validation rules, and robustness features.

EZ Password Field #

A secure, developer-friendly Flutter password field with built-in visibility toggle and robust validation.

πŸ›‘ The Problem #

Implementing password fields repeatedly involves:

  1. Boilerplate: Manually adding obscureText toggles and icons.
  2. Complex Validation: Writing lengthy regex or logic to check for uppercase, lowercase, digits, etc.
  3. Inconsistent UX: Different error messages and validation rules across the app.

βœ… The EZ Solution #

EzPasswordField encapsulates best practices for password input into a single, drop-in widget:

  • Built-in Visibility Toggle: Comes with an eye icon to show/hide password.
  • Smart Validation: Accumulates all missing requirements into a single, clear error message (e.g., "Issues: no spaces, at least 8 characters, a digit").
  • Robustness: Easily prohibit specific characters like spaces or dashes (great for PINs).

✨ Features #

  • Zero-Config Validation: Default rules for strong passwords (min length 8, uppercase, lowercase, digits, special chars).
  • Configurable Rules: Enable/disable specific requirements or change minimum length.
  • Robustness Flags: prohibitSpaces, prohibitDashes, prohibitLetters, etc.
  • Flexible Styling: Supports all standard InputDecoration properties.

πŸ“¦ Installation #

flutter pub add ez_password_field

πŸš€ Usage #

Wrap it in a Form to enable validation:

Form(
  key: _formKey,
  child: Column(
    children: [
      EzPasswordField(
        controller: _passwordController,
        decoration: InputDecoration(labelText: 'Password'),
      ),
      ElevatedButton(
        onPressed: () {
          if (_formKey.currentState!.validate()) {
             // Handle valid submission
          }
        },
        child: Text('Submit'),
      )
    ],
  ),
)

PIN Mode (Digits Only) #

EzPasswordField(
  labelText: 'PIN',
  minLength: 4,
  requireUppercase: false,
  requireLowercase: false,
  requireSpecialChars: false,
  requireDigits: true,
  prohibitLetters: true,
  prohibitSpecialChars: true,
  prohibitSpaces: true,
  prohibitDashes: true,
  hintText: 'Enter 4 digits',
)

Custom Validation Logic #

You can still add custom logic on top of the built-in validation:

EzPasswordField(
  validator: (value) {
    if (value != null && value.contains('password')) {
      return 'Password cannot contain "password"';
    }
    return null;
  },
)

🀝 Contributing #

Contributions are welcome! Please feel free to open an issue or submit a pull request on GitHub.

πŸ“œ License #

MIT License - see the LICENSE file for details.

0
likes
160
points
15
downloads

Publisher

verified publisherezinner.com

Weekly Downloads

A highly customizable password field with built-in visibility toggle, configurable validation rules, and robustness features.

Repository (GitHub)
View/report issues

Topics

#flutter #ez-flutter #password #form #input

Documentation

Documentation
API reference

Funding

Consider supporting this project:

github.com
thanks.dev
buymeacoffee.com

License

MIT (license)

Dependencies

flutter

More

Packages that depend on ez_password_field