display multiple error

This commit is contained in:
hannathkadher
2024-09-19 13:25:21 +04:00
parent af31d33778
commit 340ac35b3e
2 changed files with 61 additions and 33 deletions
+41 -21
View File
@@ -105,8 +105,8 @@ class SignUpView extends StatelessWidget {
autocorrect: false,
autofillHints: const [AutofillHints.name],
// controller: AuthCubit.get(context).fullNameController,
validator: (value) =>
AuthCubit.get(context).fullNameValidator(value),
validator: (value) => AuthCubit.get(context)
.fullNameValidator(value),
onTapOutside: (event) {
FocusScope.of(context).unfocus();
},
@@ -114,7 +114,11 @@ class SignUpView extends StatelessWidget {
AuthCubit.get(context).fullName = value;
},
onTap: () {},
decoration: defaultInputDecoration(context, hint: "Full Name"),
decoration: defaultInputDecoration(context,
hint: "Full Name")
.copyWith(
errorMaxLines: 2,
),
),
const SizedBox(height: 16),
const BodyMedium(
@@ -129,15 +133,16 @@ class SignUpView extends StatelessWidget {
autocorrect: false,
enableSuggestions: false,
autofillHints: const [AutofillHints.email],
validator: AuthCubit.get(context).emailAddressValidator,
validator: AuthCubit.get(context)
.emailAddressValidator,
onTapOutside: (event) {
FocusScope.of(context).unfocus();
},
onChanged: (value) {
AuthCubit.get(context).email = value;
},
decoration:
defaultInputDecoration(context, hint: "[email protected]"),
decoration: defaultInputDecoration(context,
hint: "[email protected]"),
),
const SizedBox(height: 16),
const BodyMedium(
@@ -150,19 +155,25 @@ class SignUpView extends StatelessWidget {
keyboardType: TextInputType.text,
scrollPadding: EdgeInsets.zero,
autocorrect: false,
autofillHints: const [AutofillHints.password],
validator: AuthCubit.get(context).passwordValidator,
autofillHints: const [
AutofillHints.password
],
validator: AuthCubit.get(context)
.passwordValidator,
onChanged: (value) {
AuthCubit.get(context).signUpPassword = value;
AuthCubit.get(context).signUpPassword =
value;
},
onTapOutside: (event) {
FocusScope.of(context).unfocus();
},
obscureText: !AuthCubit.get(context).isPasswordVisible,
obscureText: !AuthCubit.get(context)
.isPasswordVisible,
decoration: defaultInputDecoration(context,
hint: "At least 8 characters").copyWith(
errorMaxLines: 2,
),
hint: "At least 8 characters")
.copyWith(
errorMaxLines: 8,
),
),
const SizedBox(height: 16),
const BodyMedium(
@@ -176,13 +187,17 @@ class SignUpView extends StatelessWidget {
scrollPadding: EdgeInsets.zero,
autocorrect: false,
enableSuggestions: false,
autofillHints: const [AutofillHints.password],
autofillHints: const [
AutofillHints.password
],
onChanged: (value) {},
validator: AuthCubit.get(context).reEnterPasswordCheck,
validator: AuthCubit.get(context)
.reEnterPasswordCheck,
onTapOutside: (event) {
FocusScope.of(context).unfocus();
},
obscureText: !AuthCubit.get(context).isPasswordVisible,
obscureText: !AuthCubit.get(context)
.isPasswordVisible,
decoration: defaultInputDecoration(context,
hint: "At least 8 characters"),
),
@@ -195,10 +210,12 @@ class SignUpView extends StatelessWidget {
isDone: state is AuthLoginSuccess,
isLoading: state is AuthLoading,
customButtonStyle: ButtonStyle(
backgroundColor: MaterialStateProperty.all(
backgroundColor:
MaterialStateProperty.all(
Colors.black.withOpacity(.25),
),
foregroundColor: MaterialStateProperty.all(
foregroundColor:
MaterialStateProperty.all(
Colors.white,
),
),
@@ -206,11 +223,14 @@ class SignUpView extends StatelessWidget {
'Sign up',
),
onPressed: () {
AuthCubit.get(context).showValidationMessage = true;
if (formKey.currentState!.validate()) {
AuthCubit.get(context)
.showValidationMessage = true;
if (formKey.currentState!
.validate()) {
if ((state is! AuthLoading)) {
AuthCubit.get(context).signUp();
FocusScope.of(context).unfocus();
FocusScope.of(context)
.unfocus();
}
}
},