v2.0.0flutter_pw_validator
Flutter Pw Validator 套件可協助您根據您的規則驗證登入時使用者輸入的密碼。
176喜歡 2780近 30 天下載160Pub 分數
AndroidiOSWebmacOSWindowsLinux
Flutter 密碼驗證器套件可幫助您在您的 Flutter 應用程式中驗證使用者輸入的密碼。
以下為英文專案原文快照,最新內容請造訪 GitHub。



Flutter Password Validator package helps you to validate sign-in user-entered passwords with your rules.
dependencies:
flutter_pw_validator: <latest>
flutter pub get
import 'package:flutter_pw_validator/flutter_pw_validator.dart';
new TextField(
controller: _passwordController
),
new FlutterPwValidator(
controller: _passwordController,
minLength: 6,
uppercaseCharCount: 2,
lowercaseCharCount: 2,
numericCharCount: 3,
specialCharCount: 1,
width: 400,
height: 150,
onSuccess: yourCallbackFunction,
onFail: yourCallbackFunction
)
| Property | Description | Default Value | Required |
|---|---|---|---|
| controller | Takes your password TextField controller | null | Yes |
| minLength | Takes total minimum length of password | null | Yes |
| uppercaseCharCount | Takes minimum uppercase character count that has to include in the password | 0 | No |
| lowercaseCharCount | Takes minimum lowercase character count that has to include in the password | 0 | No |
| numericCharCount | Takes minimum numeric character count that has to include in the password | 0 | No |
| specialCharCount | Takes minimum special character count that has to include in the password | 0 | No |
| width | Takes the widget width | null | Yes |
| height | Takes the widget height | null | Yes |
| onSuccess | A void callback function that runs when the password is matched with the condition(s) | null | Yes |
| onFail | A void callback that gets called everytime the password doesn't match with the condition(s) | null | No |
| defaultColor | Takes default state color of the widget | Color(0xFFd3d3d3) | No |
| successColor | Takes success state color of the widget | Color(0xFF2ee292) | No |
| failureColor | Takes failure state color of the widget | Color(0xFFf9433e) | No |
| strings | A class implementing the default FlutterPwValidatorStrings |
English FlutterPwValidatorStrings |
No |
| key | Key to access the widget state and its functions GlobalKey<FlutterPwValidatorState>() |
null | No |
If you want to translate this plugin simply implements the FlutterPwValidatorStrings class and pass it to the widget.
class FrenchStrings implements FlutterPwValidatorStrings {
@override
final String atLeast = 'Au moins - caractères';
@override
final String uppercaseLetters = '- Lettres majuscules';
@override
final String numericCharacters = '- Chiffres';
@override
final String specialCharacters = '- Caractères spéciaux';
}
FlutterPwValidator(
// ...
// your config above
strings: FrenchStrings()
)
依賴清單 2 項
{"sdk":"flutter"}{"sdk":"flutter"}先依使用情境篩選,再比較專案活躍情況,最後到原始儲存庫確認使用要求。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗