-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
709f5c7
commit 26ecfe7
Showing
2 changed files
with
48 additions
and
23 deletions.
There are no files selected for viewing
26 changes: 20 additions & 6 deletions
26
lib/app/features/auth/views/pages/fill_profile/validators.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,25 @@ | ||
bool validateName(String text) { | ||
return text.trim().isNotEmpty; | ||
String? validateName(String text) { | ||
if (text.trim().isEmpty) { | ||
return 'Field is required'; | ||
} | ||
|
||
return null; | ||
} | ||
|
||
bool validateNickname(String text) { | ||
return text.trim().isNotEmpty && text.contains('@') && text.length > 1; | ||
String? validateNickname(String text) { | ||
if (text.trim().isEmpty) { | ||
return 'Field is required'; | ||
} else if (!text.contains('@')) { | ||
return 'Nickname must contain @'; | ||
} else if (text.length <= 1) { | ||
return 'Nickname too short'; | ||
} | ||
return null; | ||
} | ||
|
||
bool validateWhoInvited(String text) { | ||
return text.trim().isNotEmpty; | ||
String? validateWhoInvited(String text) { | ||
if (text.trim().isEmpty) { | ||
return 'Field is required'; | ||
} | ||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters