import '../l10n/l10n.dart'; class Validators { Validators._(); static String? phone(String? value) { if (value == null || value.isEmpty) { return L10n.current.validatorPhoneRequired; } final phoneRegex = RegExp(r'^\+861[3-9]\d{9}$'); if (!phoneRegex.hasMatch(value)) { return L10n.current.validatorPhoneInvalid86; } return null; } static String? password(String? value) { if (value == null || value.isEmpty) { return L10n.current.validatorPasswordRequired; } if (value.length < 8) { return L10n.current.validatorPasswordMin8; } return null; } static String? required(String? value, [String? fieldName]) { if (value == null || value.isEmpty) { return L10n.current.validatorRequired( fieldName ?? L10n.current.commonUnknown, ); } return null; } static String? nickname(String? value) { if (value == null || value.isEmpty) { return L10n.current.validatorNicknameRequired; } if (value.length < 2) { return L10n.current.validatorNicknameMin2; } return null; } }