flutter - 如何制作透明的应用栏?
问题描述
return Scaffold(
backgroundColor: Color(0xfff2edd7),
appBar: AppBar(
backgroundColor: Color(0x00000000),
elevation: 0,
),
drawer: _drawer(),
body: SingleChildScrollView(
child: Column(
children: <Widget>[
Stack(
children: <Widget>[
Container(
height: size.height * 0.3+100,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
//stops: [0.1, 0.6, 1],
colors: [Color(0xff4165a4), Color(0xff6573a4), Color(0xffa28aa5),Color(0xffccaaa7),Color(0xfff2edd7)])),
),
这是我的部分代码,我想通过具有渐变颜色的容器的颜色来改变 appbar 的颜色。
如果我将body部分定位在appbar部分之上,会解决吗?
解决方案
设置backgroundColor
为透明
appBar: new AppBar(
backgroundColor: Colors.transparent,
elevation: 0.0,
),
推荐阅读
- c# - “移动到另一个文件”后错误的大括号布局
- android - 构建失败:后向分支 70 上存在未初始化的对象
- java - 使用 Java 11 启动弹性搜索 5.0.1 时出现 AccessControlException
- camunda - Camunda 不包含任何历史记录
- aggregation - 分类变量的聚合
- java - 我正在尝试构建 url 但出现异常
- awk - 使用 awk 过滤最后 100 行的日志
- css - 如何为具有相同类名的嵌套 div 设置样式?
- asp.net-mvc - Html.DropdownListFor 未在 Internet Explorer 11 中提交所选项目
- c++ - 使用 std::filesystem 输出作为 LPCWSTR