简体   繁体   English

如何使用底部标签栏进行导航

[英]How to use Bottom Tab Bar for Navigation

I have four items in BottomTabBar我在BottomTabBar中有四个项目

I need to go to different Screens onTap on TabBar Item.我需要 go 到TabBar项目上的不同屏幕onTap

Can any one help me please谁能帮帮我

      int _currentIndex = 0;
    
      final _tabs = [
        HomePageTab(),
        Screen1Tab(),
        Screen2Tab(),
        Screen3Tab(),
      ];

bottomNavigationBar: BottomNavigationBar(
        currentIndex: _currentIndex,
        onTap: _onNavigationBarItemClick,
        fixedColor: Theme.of(context).primaryColor,
        unselectedItemColor: Colors.black,
        items: [
          BottomNavigationBarItem(icon: Icon(Icons.home), label: "Home"),
          BottomNavigationBarItem(
              icon: Icon(Icons.category), label: "Screen 1"),
          BottomNavigationBarItem(
              icon: Icon(Icons.search), label: "Screen 2"),
          BottomNavigationBarItem(
              icon: Icon(Icons.person), label: "Screen 3"),
        ],
      ),
    );

      void _onNavigationBarItemClick(int index) {
        setState(() {
          _currentIndex = index;
        });
      }

and in the body call it like;并在身体中称它为;

  body: IndexedStack(
    index: _currentIndex,
    children: _tabs,
  ),

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

相关问题 如何在 Flutter 中使用浮动底部导航栏 - How to use floating bottom navigation bar in Flutter 如何在底部导航栏中重新加载特定选项卡 flutter? - How to reload a particular tab in bottom navigation bar flutter? 底部导航栏和标签栏导致底部溢出 - Bottom overflow due to bottom navigation bar and tab Bar 使用标签点击方法时如何隐藏底部导航标签栏 - how to hide the bottom navigation tab bar in flutter when using on tab tapped method 如果使用底部导航栏,如何从其他选项卡更改活动选项卡? - How to change active tab from other tab in case of using bottom navigation bar? 在颤动中更改上部标签栏时如何有条件地显示底部导航栏 - How to conditionally show bottom navigation bar when changing upper tab bar in flutter 持久底部导航栏,如何在底部导航栏屏幕中未包含的另一个页面中使用它? - Persistent Bottom Nav Bar, How can I use that in another page that is not included in bottom navigation bar screens? 如何在我的底部导航栏中添加导航 - How to add navigation in my Bottom Navigation Bar Flutter - 如何从底部菜单导航栏的第一个选项卡屏幕打开第二个屏幕 - Flutter - How to open second screen from first tab screen of bottom menu navigation bar 如何在 Flutter 中使用底部导航选项卡栏内容仅更新一半屏幕 - How to update only half part of screen with bottom Navigation tab bar content in Flutter
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM