password_strength_checker 1.0.1
password_strength_checker: ^1.0.1 copied to clipboard
This is a Widget to check the strength of the password in a visual way, with an animation when the strength changes according to the settings given by the user.
example/example.dart
import 'package:flutter/material.dart';
import 'package:password_strength_checker/password_strength_checker.dart';
class HomePage extends StatelessWidget {
const HomePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final passNotifier = ValueNotifier<PasswordStrength?>(null);
return Scaffold(
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextField(
decoration: const InputDecoration(
border: OutlineInputBorder(),
labelText: 'Password',
),
onChanged: (value) {
passNotifier.value = PasswordStrength.calculate(text: value);
},
),
const SizedBox(height: 20),
PasswordStrengthChecker(
strength: passNotifier,
),
],
),
),
);
}
}