小编Har*_*ain的帖子

Tab 视图主体 Flutter 内的导航

该应用程序包含 TabBar 和 BottomNavigationBar。当我尝试在选项卡栏视图的主体内导航时,它会全屏导航。

这是我点击按钮时想要得到的结果 - 预期结果

但我得到这个 电流输出

这里我附上了代码-

 Widget build(BuildContext context) {
        return new Scaffold(
          appBar: new AppBar(
            title: new Text("Traveler"),
            bottom: new TabBar(controller: _controller, tabs: <Tab>[
              new Tab(text: "NEW"),
              new Tab(text: "HOTELS"),
              new Tab(text: "FOOD"),
              new Tab(text: "FUN"),
            ]),
          ),
          body: new TabBarView(
            controller: _controller,
            children: <Widget>[
              new NewPage(_index),
              new HotelsPage(_index),
              new FoodPage(_index),
              new FunPage(_index),
            ],
          ),
          bottomNavigationBar: new BottomNavigationBar(
              currentIndex: _index,
              onTap: (int _index) {
                setState(() {
                  this._index = _index;
                });
              },
              items: <BottomNavigationBarItem>[
                new BottomNavigationBarItem( …
Run Code Online (Sandbox Code Playgroud)

tabbar dart flutter flutter-navigation flutter-bottomnavigation

3
推荐指数
1
解决办法
1万
查看次数