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

Flutter AnimatedNotchBottomBar横屏模式无法占满全屏问题求助

解决AnimatedNotchBottomBar横屏无法占满宽度的问题

可行修复方案

尝试用LayoutBuilder配合ConstrainedBox强制组件宽度匹配屏幕约束:

bottomNavigationBar: LayoutBuilder(
  builder: (context, constraints) {
    return ConstrainedBox(
      constraints: BoxConstraints(
        minWidth: constraints.maxWidth,
      ),
      child: AnimatedNotchBottomBar(
        removeMargins: true,
        showBottomRadius: false,
        showTopRadius: true,
        elevation: 2.0,
        durationInMilliSeconds: 400,
        showLabel: true,
        blurOpacity: 0.4,
        blurFilterX: 5.0,
        blurFilterY: 10.0,
        color: MyConst.constIconColor,
        notchBottomBarController: notchBottomBarController,
        bottomBarItems: [], // 替换为你的实际导航项列表
      ),
    );
  },
),

备选排查方向

如果上述方案无效,可尝试以下操作:

  • 确认AnimatedNotchBottomBar为最新版本,部分旧版本存在横屏适配缺陷
  • 检查组件是否有未注意到的padding/margin属性,手动设置为EdgeInsets.zero
  • 排查Scaffold的body是否存在固定宽度约束,导致底部导航栏继承错误的布局限制

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.13 20:33:12