搜尋套件、儲存庫與 APP 分類

flutter_pw_validator 封面
套件詳情v2.0.0

flutter_pw_validator

Flutter Pw Validator 套件可協助您根據您的規則驗證登入時使用者輸入的密碼。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
2780
喜歡數
176
Pub 分數
160

安裝套件

flutter pub add flutter_pw_validator

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

Flutter Pw Validator 是一個輕量級套件,旨在根據可自訂規則驗證使用者輸入的密碼。它有助於確保密碼強度並符合特定標準,例如最小長度、包含特殊字元或數位要求。非常適合用於驗證流程,可無縫整合至多個平台的登入表單中。該套件支援 Android、iOS、Web、macOS、Windows 和 Linux,使其適用於跨平台應用。透過簡單的 API,開發者可輕鬆實施安全的密碼政策,而無需撰寫複雜的驗證邏輯。

適用情境

  • 用戶註冊表單
  • 密碼強度檢查
  • 安全登入流程
  • 身份驗證表單驗證
  • 符合安全策略

主要特色

  • 可自定義的驗證規則
  • 跨平台支援
  • 簡單整合
  • 即時反饋
  • 輕便且快速

適合對象

  • 開發安全驗證系統的開發者
  • 需要強密碼策略的應用程式
  • 跨平台 Flutter 應用
  • 移動和Web應用程式中的表單驗證
  • 重視用戶安全的團隊

使用建議

  • 需要手動設定規則
  • 無內建 UI 組件
  • 取決於開發人員定義的標準
  • 僅限密碼驗證
  • 不適合複雜的憑證管理

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Flutter Password Validator

License Pub Version GitHub stars


Flutter Password Validator package helps you to validate sign-in user-entered passwords with your rules.

How to use

1- Depend on it
Add it to your package's pubspec.yaml file:
dependencies:
  flutter_pw_validator: <latest>
2- Install it
Install packages from the command line:
flutter pub get
3- Usage
First You have to import the file:
import 'package:flutter_pw_validator/flutter_pw_validator.dart';
And then just put it right under your password TextField and pass the controller to that:
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
)
Properties
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

i18n

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()
)

Example Project

You can use this example project to see how it works.

所屬分類

依賴

依賴清單 1 項

  • password_rules^1.0.0

原始碼儲存庫

使用此套件的專案