flutter之BottomNavigationBar
1 BottomNavigationBar
BottomNavigationBar即是底部导航栏控件,显示在页面底部的设计控件,用于在试图切换,底部导航栏包含多个标签、图标或者两者搭配的形式,简而言之提供了顶级视图之间的快速导航。
2 构造函数
BottomNavigationBar({
Key key,
@required List<BottomNavigationBarItemitems,
ValueChanged<intonTap,
int currentIndex: 0,
double elevation: 8.0,
BottomNavigationBarType type,
Color fixedColor,
Color backgroundColor,
double iconSize: 24.0,
Color selectedItemColor,
Color unselectedItemColor,
double selectedFontSize: 14.0,
double unselectedFontSize: 12.0,
bool showSelectedLabels: true,
bool showUnselectedLabels
})
3 常用属性
3.1 backgroundColor:背景颜色
backgroundColor: Colors.white,
3.2 currentIndex:项目索引
currentIndex:0,
3.3 elevation :底部导航栏的Z坐标
elevation:8.0,
3.4 fixedColor:选中项目颜色的值(只读)
fixedColor:Colors.green,
3.5 iconSize:所有BottomNavigationBarItem图标的大小
iconSize: 24.0,
3.6 items:定义在底部导航栏中排列的按钮项的外观
items: [
BottomNavigationBarItem(
icon: Icon(Icons.home),
title: Text('首页'),
),
BottomNavigationBarItem(
icon: Icon(Icons.category),
title: Text('分类'),
),
BottomNavigationBarItem(
icon: Icon(Icons.settings),
title: Text('设置'),
),
],
3.7 selectedFontSize:选中时BottomNavigationBarItem标签的字体大小
selectedFontSize: 24.0,
3.8 selectedItemColor:选中时BottomNavigationBarItem.icon和BottomNavigationBarItem.label的颜色
selectedItemColor: Colors.green,
3.9 showSelectedLabels:是否为未选择的BottomNavigationBarItems显示标签
showSelectedLabels: true,
3.10 showUnselectedLabels:是否为选定的BottomNavigationBarItem显示标签
showUnselectedLabels: true,
3.11 unselectedFontSize:未选中BottomNavigationBarItem标签的字体大小
unselectedFontSize: 12.0,
3.12 unselectedItemColor:未选中的BottomNavigationBarItem.icon和BottomNavigationBarItem.labels的颜色
unselectedItemColor: Colors.green,
本文来自「青年码农」公众号,作者:青年码农,转载请注明原文链接:https://www.cnblogs.com/nmgwap/p/16331683.html
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· 实操Deepseek接入个人知识库
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· 【.NET】调用本地 Deepseek 模型
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库