Flutter Password Strength Meter

A customizable Flutter widget that provides real-time password strength feedback, with support for multiple languages.

Features

  • Real-time password strength calculation
  • Visual strength indicator with color feedback
  • Customizable strength labels
  • Helpful password improvement suggestions
  • Multi-language support
  • RTL support for Arabic and other RTL languages

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  flutter_password_strength_meter: ^1.0.1

Then run:

flutter pub get

Usage

Basic Usage

import 'package:flutter/material.dart';
import 'package:flutter_password_strength_meter/flutter_password_strength_meter.dart';

class PasswordForm extends StatefulWidget {
  @override
  _PasswordFormState createState() => _PasswordFormState();
}

class _PasswordFormState extends State<PasswordForm> {
  final TextEditingController _passwordController = TextEditingController();

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        TextField(
          controller: _passwordController,
          obscureText: true,
          decoration: InputDecoration(
            labelText: 'Password',
          ),
        ),
        SizedBox(height: 10),
        // Add the password strength meter
        PasswordStrengthMeter(
          controller: _passwordController,
        ),
      ],
    );
  }
}

Using with a Different Language

PasswordStrengthMeter(
  controller: _passwordController,
  languageCode: 'ar', // Use Arabic language
),

How It Works

The password strength meter evaluates passwords based on several criteria:

  1. Length: Password should be at least 8 characters long
  2. Uppercase letters: Should contain at least one uppercase letter
  3. Numbers: Should include at least one number
  4. Special characters: Should contain at least one special character
  5. Sequential patterns: Penalizes common sequences like "abcd" or "1234"

The strength is calculated on a scale from 0.0 to 1.0, and displayed with both a color-coded progress bar and a text label.

Strength Levels

Strength Value Label Color
0.0 - 0.25 Weak Red
0.26 - 0.5 Fair Orange
0.51 - 0.75 Good Yellow
0.76 - 1.0 Strong Green

License

This project is licensed under the GNU Lesser General Public License (LGPL) - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request