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

相關文章
相關標籤/搜索