password_field_validator

Creator: coderz1093

Last updated:

Add to Cart

Description:

password field validator

Password Field Validator #

Password Field Validator help you to validate a passwords with your rules.
Validations #

Minimum length
Uppercase count
Lowercase count
Numeric characters
Special characters



Getting started #
1. Add it to your package's pubspec.yaml file #
dependencies:
password_field_validator: 0.0.1
copied to clipboard
2. Install packages #
flutter pub get
copied to clipboard
3. Import package #
import 'package:password_field_validator/password_field_validator.dart';
copied to clipboard
Usage #
Now just add it after your TextField and pass the controller
class MyHomePage extends StatefulWidget {
MyHomePage({Key? key, required this.title}) : super(key: key);

final String title;

final TextEditingController passwordTextController = TextEditingController();

@override
State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Container(
padding: const EdgeInsets.all(25),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'Enter your password',
),
TextField(
controller: widget.passwordTextController,
obscureText: true,
),
Padding(
padding: const EdgeInsets.all(15),
child: PasswordFieldValidator(
minLength: 8,
uppercaseCharCount: 2,
lowercaseCharCount: 1,
numericCharCount: 3,
specialCharCount: 2,
defaultColor: Colors.black,
successColor: Colors.green,
failureColor: Colors.red,
controller: widget.passwordTextController,
),
),
],
),
),
),
);
}
}

copied to clipboard
Example #
You can find a simple example here

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files:

Customer Reviews

There are no reviews.