refactor: enhance navigation robustness by introducing popSafe and safePushNamedAndRemoveUntil methods and updating their usage.

This commit is contained in:
Achintha Isuru
2026-02-28 17:23:53 -05:00
parent c26128f1f2
commit 53b612851c
24 changed files with 481 additions and 334 deletions

View File

@@ -17,9 +17,9 @@ import '../widgets/phone_verification_page/phone_input.dart';
/// This page coordinates the authentication flow by switching between
/// [PhoneInput] and [OtpVerification] based on the current [AuthState].
class PhoneVerificationPage extends StatefulWidget {
/// Creates a [PhoneVerificationPage].
const PhoneVerificationPage({super.key, required this.mode});
/// The authentication mode (login or signup).
final AuthMode mode;
@@ -123,10 +123,10 @@ class _PhoneVerificationPageState extends State<PhoneVerificationPage> {
);
Future<void>.delayed(const Duration(seconds: 5), () {
if (!mounted) return;
Modular.to.navigate('/');
Modular.to.toInitialPage();
});
} else if (messageKey == 'errors.auth.unauthorized_app') {
Modular.to.pop();
Modular.to.popSafe();
}
}
},