どうも、ちょげ(@chogetarou)です。
選択されていないBottomNavigationBarItemのテキストのサイズを変える方法を紹介します。
方法

選択されていないBottomNavigationBarItemのテキストのサイズを変えるには、BottomNavigationBarの引数「unselectedFontSize」を使います。
具体的には、BottomNavigationBarの引数「unselectedFontSize」に選択されていない時のテキストのサイズを指定します。
BottomNavigationBar(
unselectedFontSize: /*選択されていない時のテキストのサイズ*/,
items: [
・・・
],
currentIndex: _currentIndex,
onTap: _onTap,
),
これで非選択のBottomNavigationBarItemのテキストのサイズを変えることが出来ます。
使用例
以下は、使用例です。
@override
Widget build(BuildContext context) {
return Scaffold(
body: _pages[_currentIndex],
bottomNavigationBar: BottomNavigationBar(
unselectedFontSize: 5,
items: [
BottomNavigationBarItem(
icon: Icon(Icons.settings),
label: 'Settings',
),
BottomNavigationBarItem(
icon: Icon(Icons.home),
label: 'Home',
),
BottomNavigationBarItem(
icon: Icon(Icons.favorite),
label: 'Favorite',
),
],
currentIndex: _currentIndex,
onTap: _onTap,
),
);
}
まとめ
非選択BottomNavigationBarIteimのテキストのサイズを変えるには、BottomNavigationBarの引数「unselectedFontSize」を使います。
https://www.choge-blog.com/programming/flutterbottomnavigationbaritem-backgroundcolor-use/

[Flutter]BottomNavigationBarの背景色を設定するには?
BottomNavigationBarの背景色を設定する方法を紹介します。

[Flutter]BottomNavigationBarItemのアイコンの大きさを設定するには?
BottomNavigationBarItemのアイコンの大きさを設定する方法を紹介します。
コメント