Flutter 吐槽下BottomNavigationBarItem的问题.

前言

打算flutter仿个掘金玩玩, 这不刚开始,就碰到问题了.git

问题

正常的底部按钮是这样的github

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"),
          ),
        ],
复制代码

掘金呢.是没有文字的.bash

因而我就想固然的把title去掉.spa

而后.code

好吧,title不能为nullcdn

可是!

这里根本没有声明是必传的好吗?blog

而后看get

这里又作校验了..真是.string

设置一个空的Text

new BottomNavigationBarItem(
            icon: Icon(Icons.person),
            title: new Text(''),
          ),
复制代码

不行,没居中.it

实际上,你须要这样:

new BottomNavigationBarItem(
            icon: Icon(Icons.person),
            title: new Container(),
          ),
复制代码

可是,强迫症写起来总以为怪怪的.这个title不须要为啥必定要设置

去github上看flutter 的issuse.#17099

好像没有改的打算.

这个东西嘛,本身去重写一个感受也不必,真是..


期待你的留言 点赞

交流群:

Flutter:782978118

Android:493180098

相关文章
相关标签/搜索