diff --git a/lib/views/home/settings/profile/profile.dart b/lib/views/home/settings/profile/profile.dart index 071d6ac..5b666e7 100644 --- a/lib/views/home/settings/profile/profile.dart +++ b/lib/views/home/settings/profile/profile.dart @@ -100,13 +100,15 @@ class _ProfileState extends State { email = value; }, initialValue: state.user.email, - validator: (value) async { + validator: (value) { + if (value.isEmpty) return null; bool emailValid = RegExp( r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+") .hasMatch(value); if (!emailValid) { return 'ایمیل وارد شده معتبر نمی‌باشد'; } + return null; }, ), // const SizedBox(height: 16), diff --git a/lib/views/widgets/didvan/text_field.dart b/lib/views/widgets/didvan/text_field.dart index 065b6d7..5508be8 100644 --- a/lib/views/widgets/didvan/text_field.dart +++ b/lib/views/widgets/didvan/text_field.dart @@ -18,7 +18,7 @@ class DidvanTextField extends StatefulWidget { final dynamic initialValue; final bool obsecureText; final bool acceptSpace; - final Function(String value)? validator; + final String? Function(String value)? validator; final TextInputType? textInputType; const DidvanTextField({ Key? key,