feat(apps): 重构 UI 架构为 presentation 层并新增 l10n 国际化支持

This commit is contained in:
qzl
2026-03-27 14:05:03 +08:00
parent b1f0eb8921
commit c592cc7854
178 changed files with 10748 additions and 5764 deletions
+45
View File
@@ -0,0 +1,45 @@
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;
}
}