前言
打算flutter仿个掘金玩玩,
这不刚开始,就碰到问题了.
问题
正常的底部按钮是这样的
bottomNavigationBar: new BottomNavigationBar(
items: [
new BottomNavigationBarItem(
icon: Icon(Icons.home),
title: new Text("123"),
),
new BottomNavigationBarItem(
icon: Icon(Icons.whatshot),
title: new Text("123"),
),
new BottomNavigationBarItem(
icon: Icon(Icons.search),
title: new Text("123"),
),
new BottomNavigationBarItem(
icon: Icon(Icons.book),
title: new Text("123"),
),
new BottomNavigationBarItem(
icon: Icon(Icons.person),
title: new Text("123"),
),
],
掘金呢.是没有文字的.
于是我就想当然的把title
去掉.
然后.
好吧,title不能为null
但是!
这里根本没有声明是必传的好吗?
然后看
这里又做校验了…真是.
设置一个空的Text
new BottomNavigationBarItem(
icon: Icon(Icons.person),
title: new Text(''),
),
不行,没居中.
实际上,你需要这样:
new BottomNavigationBarItem(
icon: Icon(Icons.person),
title: new Container(),
),
但是,强迫症写起来总觉得怪怪的.这个title不需要为啥一定要设置
去github上看flutter 的issuse.#17099
好像没有改的打算.
这个东西嘛,自己去重写一个感觉也没必要,真是…
期待你的留言 点赞
交流群:
Flutter:782978118
Android:493180098