mirror of
https://github.com/Iconica-Development/flutter_registration.git
synced 2025-05-18 21:23:43 +02:00
feat: validate email
This commit is contained in:
parent
7b830afbbc
commit
1f54717cf3
1 changed files with 6 additions and 4 deletions
|
@ -52,12 +52,14 @@ class RegistrationScreen extends StatelessWidget {
|
|||
name: 'email',
|
||||
title: 'Wat is je e-mailadres?',
|
||||
validators: [
|
||||
(value) => (value == null || value.isEmpty)
|
||||
(email) => (email == null || email.isEmpty)
|
||||
? 'Geef uw e-mailadres op'
|
||||
: null,
|
||||
(value) => !value!.contains('@')
|
||||
? 'Geef een geldig e-mailadres op'
|
||||
: null,
|
||||
(email) => RegExp(
|
||||
r'^.+@[a-zA-Z]+\.{1}[a-zA-Z]+(\.{0,1}[a-zA-Z]+)$',
|
||||
).hasMatch(email!)
|
||||
? 'Geef een geldig e-mailadres op'
|
||||
: null,
|
||||
],
|
||||
)
|
||||
],
|
||||
|
|
Loading…
Reference in a new issue