Flutter之BottomNavigationBar组件

/**
    BottomNavigationBar({
    Key key,
    @required this.items,//子选项
    this.onTap,
    this.currentIndex = 0,//选中第几个
    BottomNavigationBarType type,
    this.fixedColor,//文字颜色
    this.iconSize = 24.0,//icon图片大小
    })
 */

/**
    const BottomNavigationBarItem({
    @required this.icon,//未选中图标
    this.title,//文字
    Widget activeIcon,//选中图标
    this.backgroundColor,// 测试发现type设置为shifting时,backgroundColor才有效
    })
 */
bottomNavigationBar: BottomNavigationBar(
  items: [
    BottomNavigationBarItem(
      icon: Icon(Icons.home),
      title: Text("首页"),
      activeIcon: Icon(
        Icons.home,
        color: Color(0xffDE331F),
      ),
      backgroundColor: Color(0xfff1f1f1),
    ),
    BottomNavigationBarItem(
      icon: Icon(Icons.devices_other),
      title: Text("其他"),
      activeIcon: Icon(
        Icons.devices_other,
        color: Color(0xffDE331F),
      ),
      backgroundColor: Color(0xfff1f1f1),
    ),
  ],
  currentIndex: 1,
  fixedColor: Color(0xff00ff00),
  iconSize: 30.0,
  type: BottomNavigationBarType.fixed,
),

码云地址:https://gitee.com/xgljh/Flutter.git

你可能感兴趣的:(Flutter之BottomNavigationBar组件)