在Flutter中的所选BottomNavigationBarItem顶部显示图块

时间:2020-05-18 11:18:48

标签: flutter dart

我试图在选定的BottomNavigationBarItem上显示一个条,如下所示。这正是我所需要的。

BottomNavigationBar(
              type: BottomNavigationBarType.fixed,
              currentIndex: currentIndex,
              fixedColor: Colors.blue[800],
              onTap: (value) {

              },
              items: [
                BottomNavigationBarItem(
                    icon: Icon(
                      FontAwesomeIcons.shopify,
                      size: 21.0,
                    ),
                    title: Text(
                      'Abc',

                    )),
                BottomNavigationBarItem(
                    icon: Icon(
                      Icons.shop,
                      size: 21.0,
                    ),
                    title: Text(
                      'Second Tab',

                    )),
                ),
              ],
            ),

参考图片

Refernce image

1 个答案:

答案 0 :(得分:0)

BottomNavigationBar中的默认Flutter不支持此行为。要在Flutter中为BottomNavigationBar获得这种行为。您必须创建自己的小部件。

但是下面的软件包可以帮助您轻松实现这一目标。检查以下链接以获取该软件包:

Styled BottomNavigationBar

相关问题