Template
chore: 初始化脚手架 — sunny_mochi 企业级 Flutter 模板
Core 基础设施:Flavor 三包体系、Drift+SQLCipher 加密数据库 7 拦截器 Dio 网络栈、CrashReporter 崩溃日志、Sealed Failure 错误体系 5 色板主题系统、Auth 认证骨架(Clean Architecture)、Dev Panel、Mock Adapter 通过验证:flutter analyze(0 errors)、flutter test(全绿)、staging APK 74.8MB
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
// 对应 iOS BasicModule/Util/Validator.swift
|
||||
// 所有校验统一在此,禁止在各 Page 内重复定义
|
||||
abstract class Validator {
|
||||
static final _phoneReg = RegExp(r'^1[3-9]\d{9}$');
|
||||
static final _idCardReg = RegExp(r'^\d{17}[\dXx]$');
|
||||
// 密码:≥8位,含大小写字母和数字(iOS 原规则 ≥12 位,按需调整)
|
||||
static final _passwordReg = RegExp(
|
||||
r'^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[A-Za-z\d!@#$%^&*]{8,}$',
|
||||
);
|
||||
|
||||
static bool isValidPhone(String phone) => _phoneReg.hasMatch(phone);
|
||||
|
||||
static bool isValidIdCard(String id) => _idCardReg.hasMatch(id);
|
||||
|
||||
static bool isValidPassword(String pwd) => _passwordReg.hasMatch(pwd);
|
||||
|
||||
static bool isValidEmail(String email) => email.contains('@');
|
||||
|
||||
static bool isNotEmpty(String? value) =>
|
||||
value != null && value.trim().isNotEmpty;
|
||||
}
|
||||
Reference in New Issue
Block a user