forget password changes

This commit is contained in:
mohammad
2024-08-15 12:34:17 +03:00
parent f4cb117464
commit 562bce8c4f
3 changed files with 22 additions and 15 deletions

View File

@ -83,7 +83,10 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
}
emit(SuccessForgetState());
} catch (failure) {
emit(FailureForgetState(error: failure.toString()));
forgetValidate='Invalid Credentials!';
emit(AuthInitialState());
// emit(FailureForgetState(error: failure.toString()));
}
}
@ -103,6 +106,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
String maskedEmail = '';
String otpCode = '';
String validate = '';
String forgetValidate = '';
String regionUuid = '';
static Token token = Token.emptyConstructor();
static UserModel? user;
@ -365,10 +369,17 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
emit(LoginInitial());
return checkValidate;
}
changeValidate(ChangeValidateEvent event, Emitter<AuthState> emit,){
emit(AuthLoading());
validate='';
print('validate');
emit(LoginInitial());
}
changeForgetValidate(ChangeValidateEvent event, Emitter<AuthState> emit,){
emit(AuthLoading());
forgetValidate='';
print('validate');
emit(LoginInitial());
}
}

View File

@ -12,7 +12,7 @@ class ForgetPasswordPage extends StatelessWidget {
Widget build(BuildContext context) {
return const ResponsiveLayout(
desktopBody: ForgetPasswordWebPage(),
mobileBody:ForgetPasswordMobilePage()
mobileBody:ForgetPasswordWebPage()
);
}
}

View File

@ -204,7 +204,6 @@ class ForgetPasswordWebPage extends StatelessWidget {
Text(
"One Time Password",
style: Theme.of(context).textTheme.bodySmall!.copyWith(fontSize: 14,fontWeight: FontWeight.w400),
),
const SizedBox(height: 10),
SizedBox(
@ -220,9 +219,7 @@ class ForgetPasswordWebPage extends StatelessWidget {
child: Center(
child: InkWell(
onTap: () {
BlocProvider.of<AuthBloc>(
context)
.add(StartTimerEvent());
BlocProvider.of<AuthBloc>(context).add(StartTimerEvent());
},
child: Text(
'Get Code ${state is TimerState && !state.isButtonEnabled ? "(${BlocProvider.of<AuthBloc>(context).formattedTime(state.remainingTime)}) " : ""}',
@ -251,20 +248,17 @@ class ForgetPasswordWebPage extends StatelessWidget {
Text(
"Password",
style: Theme.of(context).textTheme.bodySmall!.copyWith(fontSize: 14,fontWeight: FontWeight.w400),
),
const SizedBox(height: 10),
SizedBox(
child: TextFormField(
validator: forgetBloc.passwordValidator,
keyboardType: TextInputType.visiblePassword,
controller:
forgetBloc.forgetPasswordController,
controller: forgetBloc.forgetPasswordController,
decoration: textBoxDecoration()!.copyWith(
hintText: 'At least 8 characters',
),
style:
const TextStyle(color: Colors.black),
style: const TextStyle(color: Colors.black),
),
),
],
@ -283,9 +277,7 @@ class ForgetPasswordWebPage extends StatelessWidget {
backgroundColor: ColorsManager.btnColor,
child: const Text('Submit'),
onPressed: () {
if (forgetBloc
.forgetFormKey.currentState!
.validate()) {
if (forgetBloc.forgetFormKey.currentState!.validate()) {
forgetBloc.add(ChangePasswordEvent());
}
},
@ -329,7 +321,11 @@ class ForgetPasswordWebPage extends StatelessWidget {
),
),
const SizedBox(height: 15.0),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [ SizedBox(child: Text(forgetBloc.forgetValidate,
style: const TextStyle(fontWeight: FontWeight.w700,color: ColorsManager.red ),),)],)
],
),
),