feat:register page ui done
This commit is contained in:
28
lib/core/helpers/validator_helpers.dart
Normal file
28
lib/core/helpers/validator_helpers.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
import 'package:food_delivery_client/core/core.dart';
|
||||
|
||||
abstract class Validators {
|
||||
static String? validatePhoneNumber(String phoneNumber) {
|
||||
if (phoneNumber.isEmpty) {
|
||||
return navigatorKey.currentContext?.loc.field_cannot_be_empty;
|
||||
} else if (phoneNumber.length < 12) {
|
||||
return navigatorKey.currentContext?.loc.invalid_phone_format;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static String? validatePassword(String password) {
|
||||
if (password.isEmpty) {
|
||||
return navigatorKey.currentContext?.loc.field_cannot_be_empty;
|
||||
} else if (password.length < 6) {
|
||||
return navigatorKey.currentContext?.loc.password_too_short;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static String? validateFields(String value) {
|
||||
if (value.isEmpty) {
|
||||
return navigatorKey.currentContext?.loc.field_cannot_be_empty;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user