首页 文章

从其他页面向TabNav页面进行颤振导航

提问于
浏览
0

我有一个带有TabBarview的bottomNavigation Bar,如下所示:

@override
  Widget build(BuildContext context) {
    return new Scaffold(
      //drawer: _drawer,
      appBar: new AppBar(automaticallyImplyLeading: false,
          title: new Text(_choice.title), actions: getAppBarActions(context)),
      bottomNavigationBar: new Material(
          color: CupertinoColors.lightBackgroundGray,
          //color: c,
          child: new Container(
            height: 50.0,
            child: new TabBar(
              controller: controller,
              //labelColor: Colors.grey,
              tabs: mytablist,
              labelStyle: new TextStyle(fontSize: 10.0),
              labelColor: CupertinoColors.activeBlue,
              unselectedLabelColor: CupertinoColors.inactiveGray,
              isScrollable: true,
              indicatorWeight: 1.0,
              indicatorColor: CupertinoColors.activeBlue,
              //indicatorPadding: new EdgeInsets.only(bottom: 5.0),
            ),
          )),
      body: new TabBarView(
        controller: controller,
        children: _tabWidgets(),
      ),
    );
  }

我有导航到的课程页面,我也导航到tabbarview上没有底部导航的页面,但是我希望能够导航到bottomnav中的一个页面,但是当我使用这样的东西时:

Navigator.of(context)..pushReplacementNamed(Chat.ChatServerPage.routeName);

它转到页面但没有appbar或bottomnavigationbar,任何人都知道如何实现这一目标?我已经尝试了所有我能找到的东西 . 任何帮助,将不胜感激 .

1 回答

  • 0

    检查您的小部件层次结构 . 通常 MaterialApp 小部件是顶级的,它包含 Navigator 小部件 . 这就是"navigation"取代整个屏幕的原因 .

    您可以使用不同的方法来实现此:

    • 每个页面都有自己的 Scaffold 与AppBar和NavBar . Related question

    • 可以有多个导航器 . 并且可以在Scaffold体中添加单独的Navigator . Related question

相关问题