Flutter 组件 BottomNavigationBar
xxxixxxx
1
2
3
int index = 0;
var pages = [HomePage(), SearchPage(), SetPage()];
var titls = [Text('首页'), Text('搜索'), Text('设置')];

BottomNavigationBar

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

BottomNavigationBar(
selectedItemColor: Colors.orangeAccent,
iconSize: 34,
// type: BottomNavigationBarType.shifting,
unselectedItemColor: Colors.grey,
// showSelectedLabels: false,
// showUnselectedLabels: false,
currentIndex: index,
onTap: (index) {
setState(() {
this.index = index;
});
},
items: [
BottomNavigationBarItem(
icon: Icon(Icons.home),
label: '首页',
activeIcon: Icon(
Icons.home,
color: Colors.orangeAccent,
)),
BottomNavigationBarItem(
icon: Icon(Icons.search),
label: '搜索',
activeIcon: Icon(
Icons.search,
color: Colors.orangeAccent,
)),
BottomNavigationBarItem(
icon: Icon(Icons.settings),
label: '设置',
activeIcon: Icon(
Icons.settings,
color: Colors.orangeAccent,
)),
],
),
  • Post title:Flutter 组件 BottomNavigationBar
  • Post author:xxxixxxx
  • Create time:2020-12-29 10:41:00
  • Post link:https://xxxixxx.github.io/2020/12/29/400-Flutter组件BottomNavigationBar/
  • Copyright Notice:All articles in this blog are licensed under BY-NC-SA unless stating additionally.
 Comments