add auth, format
This commit is contained in:
@@ -244,9 +244,7 @@ class Validators {
|
||||
}
|
||||
|
||||
if (double.tryParse(value) == null) {
|
||||
return fieldName != null
|
||||
? '$fieldName phải là số'
|
||||
: 'Giá trị phải là số';
|
||||
return fieldName != null ? '$fieldName phải là số' : 'Giá trị phải là số';
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -351,7 +349,8 @@ class Validators {
|
||||
);
|
||||
|
||||
final today = DateTime.now();
|
||||
final age = today.year -
|
||||
final age =
|
||||
today.year -
|
||||
birthDate.year -
|
||||
(today.month > birthDate.month ||
|
||||
(today.month == birthDate.month && today.day >= birthDate.day)
|
||||
@@ -456,11 +455,7 @@ class Validators {
|
||||
// ========================================================================
|
||||
|
||||
/// Validate against custom regex pattern
|
||||
static String? pattern(
|
||||
String? value,
|
||||
RegExp pattern,
|
||||
String errorMessage,
|
||||
) {
|
||||
static String? pattern(String? value, RegExp pattern, String errorMessage) {
|
||||
if (value == null || value.trim().isEmpty) {
|
||||
return 'Trường này là bắt buộc';
|
||||
}
|
||||
@@ -491,12 +486,7 @@ class Validators {
|
||||
}
|
||||
|
||||
/// Password strength enum
|
||||
enum PasswordStrength {
|
||||
weak,
|
||||
medium,
|
||||
strong,
|
||||
veryStrong,
|
||||
}
|
||||
enum PasswordStrength { weak, medium, strong, veryStrong }
|
||||
|
||||
/// Password strength calculator
|
||||
class PasswordStrengthCalculator {
|
||||
|
||||
Reference in New Issue
Block a user