flutter_password_strength

Flutter 的密码强度检查器。

flutter_password_strength

特点

  • 线性强度指示器。
  • 自定义颜色、边框等。

用法

  import 'package:flutter_password_strength/flutter_password_strength.dart';

  FlutterPasswordStrength(
    password: _password, 
    strengthCallback: (strength){
      debugPrint(strength.toString());
    }
  )

参数

参数 默认值 类型 描述
password 必需 字符串 密码
width 双精度 强度条宽度
高度 5 双精度 强度条高度
strengthColors TweenSequence<Color> 0.0 ~ 0.25 : 红色, 0.26 ~ 0.5 : 黄色, 0.51 ~ 0.75 : 蓝色, 0.76 ~ 1 : 绿色
backgroundColor Colors.grey 颜色 强度条背景
radius 0 双精度 强度条半径
duration 3000 持续时间 动画持续时间
strengthCallback void Function(double strength) 强度回调,返回 0 到 1 之间的值

GitHub

https://github.com/flutter-password-strength