Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 显示底部导航栏,但未选择其任何项目_Flutter_Dart_Flutter Layout - Fatal编程技术网

Flutter 显示底部导航栏,但未选择其任何项目

Flutter 显示底部导航栏,但未选择其任何项目,flutter,dart,flutter-layout,Flutter,Dart,Flutter Layout,这是我的底部导航栏,现在我想显示底部导航栏,但最初它的项目没有被选中。当我将_selectedIndex设置为null时,我得到一个错误。 有什么办法可以做到这一点 int _selectedIndex = 0; BottomNavigationBar( backgroundColor: Colors.blueAccent, unselectedItemColor: Colors.white, items: [ BottomNavigationBarItem(

这是我的底部导航栏,现在我想显示底部导航栏,但最初它的项目没有被选中。当我将_selectedIndex设置为null时,我得到一个错误。 有什么办法可以做到这一点

  int _selectedIndex = 0;

  BottomNavigationBar(
  backgroundColor: Colors.blueAccent,
  unselectedItemColor: Colors.white,

  items: [
    BottomNavigationBarItem(
      icon: Icon(Icons.add),
      title: Text(''),
    ),
    BottomNavigationBarItem(
      icon: Icon(Icons.camera_alt),
      title: Text(''),
    ),
    BottomNavigationBarItem(
      icon: Icon(Icons.person),
      title: Text(''),
    ),
  ],
  currentIndex: _selectedIndex,
  onTap: (index) {
    setState(() {
      _selectedIndex = index;
    });
  },
);
与此情况类似: