Flutter BottomNavigationBar 组件

目录

参数详解

 代码示例

效果图

完整代码


 

参数详解

属性说明
type

风格

BottomNavigationBarType.fixed(超过4个按键一定要加这个,说明是多个按钮

BottomNavigationBarType.shifting

itemsList<BottomNavigationBarItem>[]   底部导航条按钮集合
onTap选中变化回调函数
currentIndex索引值,默认0   默认选中第几个
elevation默认8
iconSize图片大小
BottomNavigationBarType.fixed  风格属性
fixedColor选中的颜色
backgroundColor背景颜色
BottomNavigationBarType.shifting  风格属性
selectedItemColor选中时颜色
unselectedItemColor未选中时颜色
selectedIconTheme 
unselectedIconTheme 
selectedFontSize默认14
unselectedFontSize默认12
selectedLabelStyle 
unselectedLabelStyle 
showSelectedLabels默认true
showUnselectedLabels 

BottomNavigationBarItem 

属性说明
icon图标
title文字
activeIcon选中后的图标
backgroundColor背景色

 代码示例

简单的应用代码如下:

bottomNavigationBar: BottomNavigationBar(
        type: BottomNavigationBarType.fixed,
        items: <BottomNavigationBarItem>[
          BottomNavigationBarItem(
              icon: Icon(Icons.home),
              title: Text('首页')
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.category),
              title: Text('分类')
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.settings),
              title: Text('设置')
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.account_circle),
              title: Text('我的')
            ),
        ],
      ),

可以互动的BottomNavigationBar请见完整代码

效果图

              

完整代码

查看完整代码 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

马志武

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值