导航问题(底部导航栏)

时间:2020-04-11 12:43:59

标签: flutter navigation

我在整个应用程序中都有持久的底部导航栏(登录页面除外)。看起来像:

    Widget build(BuildContext context) {
return Scaffold(
  body: IndexedStack(
      index: _currentIndex,
      children: <Widget>[
        Navigator(
            key:_userScreen,
            onGenerateRoute: (route) => MaterialPageRoute(
              settings: route,
              builder: (context) => UserPage(userId: 
                       widget.userId),
            ),
          ),
        ),
        Navigator(
          key: _searchScreen,
          onGenerateRoute: (route) => MaterialPageRoute(
            settings: route,
            builder: (context) => SearchPage(userId: 
            widget.userId),
          ),
        ),
        Navigator(
          key:_optionsScreen,
          onGenerateRoute: (route) => MaterialPageRoute(
            settings: route,
            builder: (context) => OptionsPage(userId: 
            widget.userId),
          ),
        ),
      ]
  ),
   bottomNavigationBar: BottomNavigationBar(
    type: BottomNavigationBarType.fixed,
    selectedFontSize: 12.0,
    unselectedFontSize: 12.0,
    currentIndex: _currentIndex,
    onTap: (val) => _onTap(val, context),
    backgroundColor: Colors.blue[50],
    items: [
      BottomNavigationBarItem(
        icon: Icon(LineIcons.graduation_cap),
        title: Text('Courses'),
      ),
      BottomNavigationBarItem(
        icon: Icon(LineIcons.search),
        title: Text('Search'),
      ),
      BottomNavigationBarItem(
        icon: Icon(LineIcons.user),
        title: Text('Options'),
      ),
    ],
  ),
);

}

现在,我想删除页面之一上的底部导航栏(用于打开视频播放器)。我该怎么做? 我试图在我的应用程序主目录中建立到videoPage的单独路由,并使用Navigator.pushNamed转到那里,但由于我位于另一个导航器中,因此转到该导航器的根目录...。

0 个答案:

没有答案