// 对应 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; }