edit profile bug fixed

This commit is contained in:
MohammadTaha Basiri 2022-03-09 21:55:32 +03:30
parent 60927b8b4c
commit 903bc65b67
2 changed files with 4 additions and 2 deletions

View File

@ -100,13 +100,15 @@ class _ProfileState extends State<Profile> {
email = value; email = value;
}, },
initialValue: state.user.email, initialValue: state.user.email,
validator: (value) async { validator: (value) {
if (value.isEmpty) return null;
bool emailValid = RegExp( bool emailValid = RegExp(
r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+") r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+")
.hasMatch(value); .hasMatch(value);
if (!emailValid) { if (!emailValid) {
return 'ایمیل وارد شده معتبر نمی‌باشد'; return 'ایمیل وارد شده معتبر نمی‌باشد';
} }
return null;
}, },
), ),
// const SizedBox(height: 16), // const SizedBox(height: 16),

View File

@ -18,7 +18,7 @@ class DidvanTextField extends StatefulWidget {
final dynamic initialValue; final dynamic initialValue;
final bool obsecureText; final bool obsecureText;
final bool acceptSpace; final bool acceptSpace;
final Function(String value)? validator; final String? Function(String value)? validator;
final TextInputType? textInputType; final TextInputType? textInputType;
const DidvanTextField({ const DidvanTextField({
Key? key, Key? key,