mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-08-25 17:59:39 +00:00
Merge pull request #115 from SyncrowIOT/SP-349-fe-implement-consistent-name-validation-in-profile-section-same-as-sign-up
[FE] Implement Consistent Name Validation in Profile Section same as sign up
This commit is contained in:
@ -262,6 +262,17 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
|
|||||||
if (parts.any((part) => part.length < 2 || part.length > 30)) {
|
if (parts.any((part) => part.length < 2 || part.length > 30)) {
|
||||||
return 'Full name parts must be between 2 and 30 characters long';
|
return 'Full name parts must be between 2 and 30 characters long';
|
||||||
}
|
}
|
||||||
|
if (RegExp(r"\s{2,}").hasMatch(value)) {
|
||||||
|
return 'Only one space is allowed between first and last names';
|
||||||
|
}
|
||||||
|
// Check for leading or trailing spaces
|
||||||
|
if (value != value.trim()) {
|
||||||
|
return 'No leading or trailing spaces allowed';
|
||||||
|
}
|
||||||
|
// Check if only alphabetic characters and one space are used
|
||||||
|
if (!RegExp(r'^[A-Za-z]+(?: [A-Za-z]+)?$').hasMatch(value)) {
|
||||||
|
return 'Only alphabetic characters and a single space are allowed';
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user