Deliver localized auth app with verification and go_router
Integrate themed login/signup, EN/RU localization, shared dummy providers, verification recovery screens and named URL routes. Store frontend guidelines, workflow skills, validation and delivery documentation. Related to #2, #3, #5 and #6.
This commit is contained in:
1 parent
27424ed886
commit
10a278c65a
44 files changed
+4128
-28
No files matched your search
@@ -0,0 +1,35 @@
|
||||
import '../generated/i18n/app_localizations.dart';
|
||||
|
||||
abstract final class AuthValidation {
|
||||
static String? email(String? value, AppLocalizations l) {
|
||||
final email = value?.trim() ?? '';
|
||||
if (email.isEmpty) return l.emailRequired;
|
||||
if (!RegExp(r'^[^\s@]+@[^\s@]+\.[^\s@]+$').hasMatch(email)) {
|
||||
return l.emailInvalid;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static String? name(String? value, AppLocalizations l) =>
|
||||
(value?.trim().isEmpty ?? true) ? l.nameRequired : null;
|
||||
|
||||
static String? password(
|
||||
String? value,
|
||||
AppLocalizations l, {
|
||||
required bool signUp,
|
||||
}) {
|
||||
if (value == null || value.isEmpty) return l.passwordRequired;
|
||||
if (signUp && value.length < 12) return l.passwordHint;
|
||||
return null;
|
||||
}
|
||||
|
||||
static String? confirmation(
|
||||
String? value,
|
||||
String password,
|
||||
AppLocalizations l,
|
||||
) => value == null || value.isEmpty
|
||||
? l.confirmationRequired
|
||||
: value != password
|
||||
? l.passwordMismatch
|
||||
: null;
|
||||
}
|
||||
Reference in new issue
Block a user