【问题标题】:Show Tile on top of selected BottomNavigationBarItem in Flutter在 Flutter 中选定的 BottomNavigationBarItem 顶部显示 Tile
【发布时间】:2020-09-04 04:21:13
【问题描述】:

我正在尝试在选定的 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',

                    )),
                ),
              ],
            ),

参考图片

【问题讨论】:

  • 使用默认的BottomNavigationBar 小部件您不能这样做,但您始终可以创建自己的小部件。

标签: flutter dart


【解决方案1】:

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

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

Styled BottomNavigationBar

【讨论】:

    猜你喜欢
    • 2022-01-06
    • 2020-02-17
    • 2021-03-15
    • 1970-01-01
    • 2012-10-18
    • 1970-01-01
    • 2019-05-27
    • 2011-06-10
    • 2016-05-17
    相关资源
    最近更新 更多