Update lib/screens/manage_collection_screen.dart
add email regex Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
94e0ab436b
commit
05bdd281b6
1 changed files with 8 additions and 1 deletions
|
|
@ -167,10 +167,17 @@ class _ManageCollectionScreenState extends State<ManageCollectionScreen> {
|
||||||
|
|
||||||
if (result != true) return;
|
if (result != true) return;
|
||||||
|
|
||||||
|
final email = emailCtrl.text.trim();
|
||||||
|
final emailRegex = RegExp(r'^[^@\s]+@[^@\s]+\.[^@\s]+$');
|
||||||
|
if (!emailRegex.hasMatch(email)) {
|
||||||
|
showGlobalSnackBar('Please enter a valid email address.', isError: true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await CollectionService.inviteByEmail(
|
await CollectionService.inviteByEmail(
|
||||||
collectionId: _collection.id,
|
collectionId: _collection.id,
|
||||||
email: emailCtrl.text.trim(),
|
email: email,
|
||||||
);
|
);
|
||||||
showGlobalSnackBar('Member invited!');
|
showGlobalSnackBar('Member invited!');
|
||||||
_loadMembers();
|
_loadMembers();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue