简体   繁体   English

如何导航到后退按钮不会导航到上一页的其他页面

[英]How to navigate to other page that back button won't navigate to previous page

I had created login page and its functionality and I am redirecting to home page if email and password works correctly.我已经创建了登录页面及其功能,如果 email 和密码正常工作,我将重定向到主页。 Now if I press back button it navigates back to login page.现在,如果我按下返回按钮,它会导航回登录页面。 What I want is if email and password is correct it navigate to home page but if I press back button it exits the app rather than moving back to login page and if I logout it navigates to login page and if I press back button i won't navigate to homepage.我想要的是,如果 email 和密码正确,它会导航到主页,但如果我按下后退按钮,它会退出应用程序而不是返回登录页面,如果我注销它会导航到登录页面,如果我按下后退按钮,我将不会t 导航到主页。 There are so many ways to navigates through pages in flutter like push , pushReplacement , pushNamedReplacement etc but I font exactly knows what they are and how they work because I only used Navigator.push .有很多方法可以在 flutter 中导航页面,例如pushpushReplacementpushNamedReplacement等,但我的字体完全知道它们是什么以及它们是如何工作的,因为我只使用了Navigator.push I want to navigate to other page removing traces of previous page that if I login and navigate to home page it would behave like HomePage is the default and there is no previous page.我想导航到其他页面,删除上一页的痕迹,如果我登录并导航到主页,它的行为就像 HomePage 是默认值并且没有上一页。 I hope you understand what I want to ask我希望你明白我想问什么

I had created login page and its functionality and I am redirecting to home page if email and password works correctly.我已经创建了登录页面及其功能,如果 email 和密码正常工作,我将重定向到主页。 Now if I press back button it navigates back to login page.现在,如果我按下返回按钮,它会导航回登录页面。 What I want is if email and password is correct it navigate to home page but if I press back button it exits the app rather than moving back to login page and if I logout it navigates to login page and if I press back button i won't navigate to homepage.我想要的是,如果 email 和密码正确,它会导航到主页,但如果我按下后退按钮,它会退出应用程序而不是返回登录页面,如果我注销它会导航到登录页面,如果我按下后退按钮,我将不会t 导航到主页。 There are so many ways to navigates through pages in flutter like push , pushReplacement , pushNamedReplacement etc but I font exactly knows what they are and how they work because I only used Navigator.push .有很多方法可以在 flutter 中导航页面,例如pushpushReplacementpushNamedReplacement等,但我的字体完全知道它们是什么以及它们是如何工作的,因为我只使用了Navigator.push I want to navigate to other page removing traces of previous page that if I login and navigate to home page it would behave like HomePage is the default and there is no previous page.我想导航到其他页面,删除上一页的痕迹,如果我登录并导航到主页,它的行为就像 HomePage 是默认值并且没有上一页。 I hope you understand what I want to ask我希望你明白我想问什么

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM