From 6f24e7ad58afc51d9fa158fe48bf2362ca5ac3c2 Mon Sep 17 00:00:00 2001 From: Erick Date: Tue, 24 Sep 2024 06:38:14 +0300 Subject: [PATCH] fix: navigating back to homescreen even after successfull login --- lib/pages/auth/login_page.dart | 10 +++++----- lib/pages/auth/register_page.dart | 3 ++- lib/tools/chirp/models/services/chirp_service.dart | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/pages/auth/login_page.dart b/lib/pages/auth/login_page.dart index f6c2eda..fa61e74 100644 --- a/lib/pages/auth/login_page.dart +++ b/lib/pages/auth/login_page.dart @@ -49,11 +49,11 @@ class _LoginPageState extends State { HapticFeedback.heavyImpact().then((value) { if (userController.isLoggedIn.value) { if (!mounted) return; - Navigator.of(context).pushReplacement( - MaterialPageRoute( - builder: (context) => const LayoutPage(), - ), - ); + Navigator.of(context).pushAndRemoveUntil( + MaterialPageRoute(builder: (context) => const LayoutPage()), + (predicate) => false + // (Route) => false, + ); return; } }); diff --git a/lib/pages/auth/register_page.dart b/lib/pages/auth/register_page.dart index bf8bc1b..40aee11 100644 --- a/lib/pages/auth/register_page.dart +++ b/lib/pages/auth/register_page.dart @@ -40,10 +40,11 @@ class _RegisterPageState extends State { }, (r) { if (r && userController.isLoggedIn.value) { HapticFeedback.heavyImpact().then((value) {}); - Navigator.of(context).pushReplacement( + Navigator.of(context).pushAndRemoveUntil( MaterialPageRoute( builder: (context) => const LayoutPage(), ), + (predicate) => false, ); return; } diff --git a/lib/tools/chirp/models/services/chirp_service.dart b/lib/tools/chirp/models/services/chirp_service.dart index 7b346ed..e28a643 100644 --- a/lib/tools/chirp/models/services/chirp_service.dart +++ b/lib/tools/chirp/models/services/chirp_service.dart @@ -1,4 +1,4 @@ class ChirpService { - static const urlPrefix = "http://192.168.2.115:8080"; + static const urlPrefix = "http://127.0.0.1:8080"; // static const urlPrefix = "http://62.169.16.219:84"; }