forgot password screns logic fixed

This commit is contained in:
amirrezaghabeli
2025-09-22 14:25:59 +03:30
parent a9450a60d7
commit e85ac8d649
13 changed files with 209 additions and 133 deletions
@@ -33,7 +33,10 @@ class _DesktopForgotPasswordPageState extends State<DesktopForgotPasswordPage> {
void _viewModelListener() {
if (viewModel.successMessage != null) {
AppToast.success(context, viewModel.successMessage!);
const ForgotPasswordOtpRouteData().push(context);
Router.neglect(
context,
() => const ForgotPasswordOtpRouteData().pushReplacement(context),
);
viewModel.clearMessages();
}
@@ -103,19 +106,21 @@ class _DesktopForgotPasswordPageState extends State<DesktopForgotPasswordPage> {
SizedBox(height: 70.0.h()),
viewModel.isLoadingForgot
? const BaseButton(
isEnabled: false,
text: ForgotPasswordStrings.resetLink,
onPressed: null,
)
isEnabled: false,
text: ForgotPasswordStrings.resetLink,
onPressed: null,
isLoading: true,
)
: BaseButton(
isEnabled: viewModel.isEmailValid,
text: ForgotPasswordStrings.resetLink,
onPressed: viewModel.isEmailValid
? () async {
isEnabled: viewModel.isEmailValid,
text: ForgotPasswordStrings.resetLink,
onPressed:
viewModel.isEmailValid
? () async {
await viewModel.forgotPassword(context);
}
: null,
),
: null,
),
const SizedBox(height: 12),
TextButton(
onPressed: () {
@@ -33,7 +33,7 @@ class _MobileForgotPasswordPageState extends State<MobileForgotPasswordPage> {
void _viewModelListener() {
if (viewModel.successMessage != null) {
AppToast.success(context, viewModel.successMessage!);
const ForgotPasswordOtpRouteData().push(context);
const ForgotPasswordOtpRouteData().pushReplacement(context);
viewModel.clearMessages();
}
@@ -98,19 +98,21 @@ class _MobileForgotPasswordPageState extends State<MobileForgotPasswordPage> {
SizedBox(height: 24.0.h()),
viewModel.isLoadingForgot
? const BaseButton(
isEnabled: false,
text: ForgotPasswordStrings.resetLink,
onPressed: null,
)
isEnabled: false,
text: ForgotPasswordStrings.resetLink,
onPressed: null,
isLoading: true,
)
: BaseButton(
isEnabled: viewModel.isEmailValid,
text: ForgotPasswordStrings.resetLink,
onPressed: viewModel.isEmailValid
? () async {
isEnabled: viewModel.isEmailValid,
text: ForgotPasswordStrings.resetLink,
onPressed:
viewModel.isEmailValid
? () async {
await viewModel.forgotPassword(context);
}
: null,
),
: null,
),
TextButton(
onPressed: () {
Navigator.pop(context);
@@ -33,7 +33,10 @@ class _TabletForgotPasswordPageState extends State<TabletForgotPasswordPage> {
void _viewModelListener() {
if (viewModel.successMessage != null) {
AppToast.success(context, viewModel.successMessage!);
const ForgotPasswordOtpRouteData().push(context);
Router.neglect(
context,
() => const ForgotPasswordOtpRouteData().pushReplacement(context),
);
viewModel.clearMessages();
}
@@ -97,19 +100,21 @@ class _TabletForgotPasswordPageState extends State<TabletForgotPasswordPage> {
SizedBox(height: 24.0.h()),
viewModel.isLoadingForgot
? const BaseButton(
isEnabled: false,
text: ForgotPasswordStrings.resetLink,
onPressed: null,
)
isEnabled: false,
text: ForgotPasswordStrings.resetLink,
onPressed: null,
isLoading: true,
)
: BaseButton(
isEnabled: viewModel.isEmailValid,
text: ForgotPasswordStrings.resetLink,
onPressed: viewModel.isEmailValid
? () async {
isEnabled: viewModel.isEmailValid,
text: ForgotPasswordStrings.resetLink,
onPressed:
viewModel.isEmailValid
? () async {
await viewModel.forgotPassword(context);
}
: null,
),
: null,
),
const SizedBox(height: 12),
TextButton(
onPressed: () {