【发布时间】:2019-04-10 09:44:18
【问题描述】:
我想制作一个带有文本和图标的按钮,带有自定义背景颜色和自定义宽度。具有固定位置(不可滚动)。你愿意帮我吗?
代码如下:
bottomNavigationBar: BottomNavigationBar(
type: BottomNavigationBarType.shifting,
currentIndex: 0, // this will be set when a new tab is tapped
items: [
BottomNavigationBarItem(icon: Icon(Icons.supervised_user_circle), title: Text('Players'),backgroundColor: Colors.red),
BottomNavigationBarItem(icon: Icon(Icons.whatshot), title: Text('Trending'),backgroundColor: Colors.blueAccent),
BottomNavigationBarItem(icon: Icon(Icons.access_time), title: Text('Highlights'),backgroundColor: Colors.yellow)
]
它只为图标提供一种颜色。
这就是我想要的:
【问题讨论】:
-
这个功能最好使用
Stack。 -
试试输入
BottomNavigationBarType.fixed -
堆栈?可以固定位置吗? @CopsOnRoad 先生
-
是的,它会在一个固定的位置。
-
ok,先生,我要试试。在堆栈中包装按钮图标对吗? @CopsOnRoad
标签: android flutter flutter-layout bottombar