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:
Lukas Müllner 2026-02-24 20:15:17 +01:00 committed by GitHub
parent 94e0ab436b
commit 05bdd281b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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();