【问题标题】:The named parameter 'title' isn't defined. Try correcting the name to an existing named parameter's name未定义命名参数“title”。尝试将名称更正为现有命名参数的名称
【发布时间】:2022-07-06 02:54:34
【问题描述】:
return BottomNavigationBar(
      type: BottomNavigationBarType.fixed,
      items: const <BottomNavigationBarItem>[
        BottomNavigationBarItem(
          icon: Icon(Icons.home),
          title: Text(  
            'Home',
            style: TextStyle(color: Color(0xFF545454)),
          ),
        ),
        BottomNavigationBarItem(
          icon: Icon(FontAwesomeIcons.heart),
          title: Text(
            'Wish List',
            style: TextStyle(color: Color(0xFF545454)),
          ),
        ),
        BottomNavigationBarItem(
          icon: Icon(FontAwesomeIcons.shoppingBag),
          title: Text(
            'Cart',
            style: TextStyle(color: Color(0xFF545454)),
          ),
        ),
        BottomNavigationBarItem(
          icon: Icon(FontAwesomeIcons.dashcube),
          title: Text(
            'Dashboard',
            style: TextStyle(color: Color(0xFF545454)),
          ),
        ),
      ],
      currentIndex: _selectedIndex,
      selectedItemColor: Color(0xFFAA292E),
      onTap: _onItemTapped,
    );
  }
}

【问题讨论】:

    标签: flutter


    【解决方案1】:

    BottomNavigationBarItem 不再有title 参数。现在应该是这样的:

        BottomNavigationBarItem(
          icon: Icon(FontAwesomeIcons.heart),
          label: 'Wish List',
        ),
    

    【讨论】:

      猜你喜欢
      • 2021-05-13
      • 2021-01-08
      • 1970-01-01
      • 2023-04-11
      • 2020-09-03
      • 2023-02-07
      • 2022-08-22
      • 1970-01-01
      • 2022-06-10
      相关资源
      最近更新 更多