简体   繁体   English

如何在没有Cupertino底部栏的情况下转到新页面

[英]how to route to a new page without the Cupertino bottom bar

I am using the Cupertino tab to display a bottom navigation bar and it working good. 我正在使用Cupertino标签来显示底部的导航栏,并且效果很好。 Now, I want to route to a new page from one of the tab pages (Eg login)and not have the bottom navigation. 现在,我想从选项卡页面之一(例如,登录名)路由到新页面,而没有底部导航。 I tried the code below and I still see the bottom navigation. 我尝试了下面的代码,但仍然看到底部导航。

How can I route to a page and not show the bottom navigation 如何路由到页面而不显示底部导航

Navigator.push(
    context,
    CupertinoPageRoute<void>(
     title: "login",
     builder: (BuildContext context) => LoginScreen(),
    ),
);

The static methods on Navigator , like Navigator.push or Navigator.of use the nearest enclosing Navigator of the context argument. Navigator上的静态方法(如Navigator.pushNavigator.of使用context参数中最接近的封闭式Navigator When using a CupertinoTabScaffold , every tab has a nested Navigator to provide in-tab navigation, as is the default iOS behavior. 使用CupertinoTabScaffold ,每个选项卡都有一个嵌套的Navigator以提供选项卡内导航,这是默认的iOS行为。 You can get the root Navigator using Navigator.of(context, rootNavigator: true) and push your route on that: 您可以使用Navigator.of(context, rootNavigator: true)获得根Navigator Navigator.of(context, rootNavigator: true)并在该路径上推送您的路线:

Navigator.of(context, rootNavigator: true).push(route)

More info about navigators in the docs 有关文档中导航器的更多信息

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

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