enter image description here

我不知道这个阴影/高亮效果是什么,但我如何删除它?

@override
  Widget build(BuildContext context) {
    return Scaffold(
      body: child,
      bottomNavigationBar: BottomNavigationBar(
        items: const <BottomNavigationBarItem>[
          BottomNavigationBarItem(
            icon: Icon(Icons.home),
            label: 'Feed',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.groups),
            label: 'Groups',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.person),
            label: 'Profile',
          ),
        ],
        currentIndex: _calculateSelectedIndex(context),
        onTap: (int idx) => _onItemTapped(idx, context),
        elevation: 0,
      ),
    );
  }

这是我的密码

推荐答案

用Theme()包装BottomNavigationBar()并提供ThemeData.

bottomNavigationBar: Theme(
      data: ThemeData(
        splashColor: Colors.transparent,
        highlightColor: Colors.transparent,
      ),
      child: BottomNavigationBar(
        items: const <BottomNavigationBarItem>[
          BottomNavigationBarItem(
            icon: Icon(Icons.home),
            label: 'Feed',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.groups),
            label: 'Groups',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.person),
            label: 'Profile',
          ),
        ],
        currentIndex: index,
        onTap: (value) {
          setState(() {
            index = value;
          });
        },
        elevation: 0,
      ),
    ),

Flutter相关问答推荐

Flutter—如何在Riverpod中使用全类状态?

如何使一个悬浮的appbar在flutter?

Dexing时出错.将Flutter 升级到3.19.0后

如何将Will POP示波器转换为POP数据抖动的POP示波器

Ffltter:发布版本中的Path NotFoundException

Flutter API请求BadState响应

什么是dart :这只是dart ?

如何在Date Time类中只显示日期?

参数类型void Function()无法分配给参数类型void Function(LongPressEndDetails)?

为什么我的图标的一半在定位小部件中消失了?

尽管海拔设置为 0,如何删除 appBar 下的下划线

Flutter:使用 GlobalKey 访问 BlocProvider

从所有设备注销,因为用户帐户已从 firebase flutter 中删除

如何在 flutter 中使用带有有效负载数据的重定向来执行 firebase 推送通知.?

如何在 flutter 中同时使用 ButtonStyle() 和 ElevatedButton.styleFrom() ?

如何对齐卡片小部件中的图标按钮?

Flutter 如何要求用户在应用程序中设置电话密码?

避免长单词中断

使用 onPressed 切换到另一个屏幕无法正常工作

Flutter_riverpod 安装时出现问题