我有一个底部导航栏
BottomNavigationBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.shopping_cart),
label: 'MyCart',
),
.
.
.
])
我想将徽章添加到 MyCart 图标,我看到 Stack 用于 BottomNavigationBar 的图标,如下所示:
new BottomNavigationBarItem(
title: new Text('Home'),
icon: new Stack(
children: <Widget>[
new Icon(Icons.home),
new Positioned( // draw a red marble
top: 0.0,
right: 0.0,
child: new Icon(Icons.brightness_1, size: 8.0,
color: Colors.redAccent),
)
]
),
)
但是当我使用它时,我得到了这个错误:
The values in a const list literal must be constants.
Try removing the keyword 'const' from the list literal.