You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用AnimatedBottomNavigationBar时,奇数图标配GapLocation.end触发渲染错误

使用AnimatedBottomNavigationBar设置gapLocation: GapLocation.end时出现异常

我尝试通过AnimatedBottomNavigationBar包实现底部导航栏,但当设置gapLocation: GapLocation.end时出现错误。

代码实现

class _marketViewPageState extends State<marketViewPage> {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Scaffold(
        appBar: AppBar(
          title: Text(" Page "),
        ),
        floatingActionButton: FloatingActionButton(
          child: const Icon(Icons.add),
          onPressed: () {},
        ),
        floatingActionButtonLocation: FloatingActionButtonLocation.endDocked,
        bottomNavigationBar: AnimatedBottomNavigationBar(
          activeColor: Colors.red,
          height: Get.height / 12, 
          backgroundColor: Colors.blue,
          notchSmoothness: NotchSmoothness.defaultEdge,
          leftCornerRadius: 15,
          gapLocation: GapLocation.end,
          icons: [
            Icons.home,
            Icons.add_shopping_cart_outlined,
            Icons.history_rounded,
            Icons.star,
            Icons.circle
          ],
          activeIndex: 1,
          onTap: (int) {
            print(int);
          },
          //other params
        ),
      ),
    );
  }
}

界面显示异常

底部导航栏显示异常

报错信息

报错截图


内容的提问来源于stack exchange,提问作者Beytullah AY

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.23 15:15:32