add email address check
This commit is contained in:
@@ -58,18 +58,11 @@ class _RegisterState extends State<Register> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void internetConnectionPopUp() {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return const MyErrorMessage(errorType: "Internet Connection");
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//sign user in
|
//sign user in
|
||||||
Future<void> signUserUp() async {
|
Future<void> signUserUp() async {
|
||||||
if (passwordController.text != confirmPasswordController.text) {
|
if (!validEmail()) {
|
||||||
|
emailError();
|
||||||
|
} else if (passwordController.text != confirmPasswordController.text) {
|
||||||
passwordError();
|
passwordError();
|
||||||
} else {
|
} else {
|
||||||
var _backgroundColor = Colors.transparent;
|
var _backgroundColor = Colors.transparent;
|
||||||
@@ -140,6 +133,20 @@ class _RegisterState extends State<Register> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool validEmail() {
|
||||||
|
String text = emailController.text;
|
||||||
|
return RegExp(r'^[\w-\.]+@[a-zA-Z]+\.[a-zA-Z]{2,}$').hasMatch(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
void internetConnectionPopUp() {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return const MyErrorMessage(errorType: "Internet Connection");
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void signUpSuccess() {
|
void signUpSuccess() {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@@ -170,6 +177,15 @@ class _RegisterState extends State<Register> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void emailError() {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return const MyErrorMessage(errorType: "Invalid Email");
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void passwordReqError() {
|
void passwordReqError() {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|||||||
Reference in New Issue
Block a user