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

如何设置BottomAppBar顶部边框为橙色且背景透明?

实现BottomAppBar透明背景+顶部橙色边框的方法

直接按下面的方式修改代码就能实现需求:

  1. 给外层Container设置透明背景,同时把边框颜色改成橙色
  2. 给内部的BottomAppBar设置backgroundColor: Colors.transparent,让它本身背景透明
  3. 可选:加上elevation: 0去掉阴影,让透明效果更自然

完整代码示例:

Container(
  decoration: const BoxDecoration(
    border: Border(top: BorderSide(color: Colors.orange, width: 2)),
    color: Colors.transparent, // 容器背景透明
  ),
  child: BottomAppBar(
    backgroundColor: Colors.transparent, // BottomAppBar背景透明
    elevation: 0, // 移除阴影,可选
    child: const Padding(
      padding: EdgeInsets.symmetric(vertical: 16),
      child: Text("你的底部导航内容"),
    ),
  ),
)

原理很简单:外层Container负责显示顶部的橙色边框,同时自身背景透明;BottomAppBar本身的背景设为透明后,就能透出下方页面的内容,完美实现你要的效果。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.02 16:07:49