【发布时间】:2021-02-23 14:06:47
【问题描述】:
我试图让我的底部导航栏像我附加的图像一样,但我似乎不明白。 以下是我尝试过的。
bottomNavigationBar: Container(
margin: EdgeInsets.only(left: 5, right: 5),
decoration: BoxDecoration(
color: Colors.amber,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(200), topRight: Radius.circular(200)),
),
child: BottomNavigationBar(
type: BottomNavigationBarType.fixed,
selectedItemColor: Colors.deepOrange,
unselectedItemColor: Colors.grey,
iconSize: 0,
items: [
BottomNavigationBarItem(
label: 'Banking',
icon: FaIcon(FontAwesomeIcons.accessibleIcon)),
BottomNavigationBarItem(
label: 'Social', icon: FaIcon(FontAwesomeIcons.accessibleIcon)),
BottomNavigationBarItem(
label: 'GTLocate',
icon: FaIcon(FontAwesomeIcons.accessibleIcon)),
BottomNavigationBarItem(
label: 'iReport',
icon: FaIcon(FontAwesomeIcons.accessibleIcon)),
BottomNavigationBarItem(
label: 'GTTraffic',
icon: FaIcon(FontAwesomeIcons.accessibleIcon)),
],
),
),
这就是我想做的 enter image description here
这是我目前拥有的 enter image description here
【问题讨论】:
-
您可以尝试将您的
FaIcon包装在Container中,并将margin添加到Container中吗? -
@Andrej 它不接受Bottomnavigationbaritem中的容器
-
不,不是
BottomNavigationBarItem,而是图标参数。像这样:BottomNavigationBarItem(icon: Container(child: YourIcon(),),.