password_check 1.0.0
password_check: ^1.0.0 copied to clipboard
This package facilitates the implementation of a checklist for password validation
PasswordChecklist Widget - README #
The PasswordChecklist widget in Flutter is a customizable UI element used to display password validation requirements and their current status. This widget helps users see which conditions their password meets in real-time, with customizable messages, colors, and icons. Below, we provide a detailed explanation of each attribute.
Attributes #
1. controller #
- Type:
TextEditingController - Description: The
controlleris used to manage and listen to changes in the password input field. It should be passed from the parent widget to ensure thePasswordChecklisthas access to the password text. - Example:
TextEditingController myController = TextEditingController();
2. onValidationChanged #
- Type:
ValueChanged<bool> - Description: A callback function that is triggered whenever the password validation status changes. This allows you to handle changes in the validation state, such as enabling or disabling a submit button.
- Example:
(isValid) { print(isValid ? "Password is valid" : "Password is invalid"); }
3. checkEightCharacters #
- Type:
bool - Description: Determines whether the widget checks for a minimum character length. If set to
true, the widget will verify that the password has at leastminCharacterscharacters. - Default:
true - Example:
checkEightCharacters: true,
4. checkSpecialCharacter #
- Type:
bool - Description: Indicates whether the widget should check for the presence of at least one special character (e.g.,
!@#$%^&*()). - Default:
true - Example:
checkSpecialCharacter: true,
5. checkNumber #
- Type:
bool - Description: Indicates whether the widget should check for the presence of at least one numeric digit.
- Default:
true - Example:
checkNumber: true,
6. checkUppercase #
- Type:
bool - Description: Specifies whether the widget should verify if the password contains at least one uppercase letter.
- Default:
true - Example:
checkUppercase: true,
7. checkLowercase #
- Type:
bool - Description: Determines if the widget should check for at least one lowercase letter in the password.
- Default:
true - Example:
checkLowercase: true,
8. checkOnlyNumbers #
- Type:
bool - Description: Indicates if the widget should check if the password is composed solely of numbers.
- Default:
false - Example:
checkOnlyNumbers: false,
9. minCharacters #
- Type:
int - Description: Specifies the minimum number of characters required for the password when
checkEightCharactersis set totrue. - Default:
8 - Example:
minCharacters: 10,
10. validColor #
- Type:
Color? - Description: The color applied to the validation text and
Checkboxwhen the condition is met. If not specified, it defaults to green. - Example:
validColor: Colors.blue,
11. invalidColor #
- Type:
Color? - Description: The color applied to the validation text and
Checkboxwhen the condition is not met. If not specified, it defaults to red. - Example:
invalidColor: Colors.orange,
12. eightCharactersMessage #
- Type:
String? - Description: Customizable message displayed when the password does not meet the minimum character requirement. If not provided, the default message is "Should contain at least X characters."
- Example:
eightCharactersMessage: 'Password must be at least 12 characters long',
13. specialCharacterMessage #
- Type:
String? - Description: Customizable message shown when the password does not contain a special character. Defaults to "Should contain a special character."
- Example:
specialCharacterMessage: 'Include at least one special character',
14. numberMessage #
- Type:
String? - Description: Customizable message displayed when the password does not contain a number. Defaults to "Should contain a number."
- Example:
numberMessage: 'Include at least one numeric digit',
15. uppercaseMessage #
- Type:
String? - Description: Customizable message displayed when the password does not contain an uppercase letter. Defaults to "Should contain an uppercase letter."
- Example:
uppercaseMessage: 'Include at least one uppercase letter',
16. lowercaseMessage #
- Type:
String? - Description: Customizable message shown when the password does not contain a lowercase letter. Defaults to "Should contain a lowercase letter."
- Example:
lowercaseMessage: 'Include at least one lowercase letter',
17. onlyNumbersMessage #
- Type:
String? - Description: Customizable message displayed when the password only contains numbers. Defaults to "Should contain only numbers."
- Example:
onlyNumbersMessage: 'Password should not be only numbers',
18. customIcon #
- Type:
Widget? - Description: An optional custom icon that will be displayed next to the validation message. If not provided, a default
Checkboxwill be shown. - Example:
customIcon: Icon(Icons.check, color: Colors.blue),