Skip to content

Commit b6325e9

Browse files
fix: pop loading dialog when loading finished for send forgot password request
1 parent a74281c commit b6325e9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

packages/flutter_user/lib/src/flutter_user_navigator_userstory.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,14 @@ class _FlutterUserNavigatorUserstoryState
173173
var requestPasswordReponse =
174174
await userService!.requestChangePassword(email: email);
175175

176+
if (!context.mounted) return;
177+
// ignore: use_build_context_synchronously
178+
Navigator.of(context).pop();
179+
176180
if (requestPasswordReponse.requestSuccesfull) {
177-
if (context.mounted) {
178-
await pushReplacement(_forgotPasswordSuccessScreen());
179-
}
181+
await pushReplacement(_forgotPasswordSuccessScreen());
180182
} else {
181-
if (context.mounted) {
182-
await push(_forgotPasswordUnsuccessfullScreen());
183-
}
183+
await push(_forgotPasswordUnsuccessfullScreen());
184184
}
185185
}
186186

@@ -272,7 +272,7 @@ class _FlutterUserNavigatorUserstoryState
272272

273273
Future<void> pushReplacement(Widget screen) async {
274274
if (!context.mounted) return;
275-
await Navigator.of(context).push(
275+
await Navigator.of(context).pushReplacement(
276276
MaterialPageRoute(
277277
builder: (context) => screen,
278278
),

0 commit comments

Comments
 (0)