flutter - 如何在 Flutter 中设置凸起按钮的背景颜色透明?
问题描述
这是我的代码,我想设置一个背景颜色,对我的按钮透明。
我想在我的代码中为两个 Raised Button 添加背景颜色。我也尝试用容器包装它,然后应用容器的背景透明,但它没有用。
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
FadeAnimation(
3.4,
SizedBox(
width: double.infinity,
height: 44,
child: RaisedButton(
color: Colors.white,
onPressed: navigateToSignUp,
child: Text(
'Sign Up',
style:
TextStyle(color: Colors.blueGrey, fontSize: 24),
),
),
),
),
SizedBox(height: 10),
FadeAnimation(
3.4,
SizedBox(
width: double.infinity,
height: 44,
child: RaisedButton(
color: Colors.white,
onPressed: navigateToSignIn,
child: Text(
'Sign In',
style: TextStyle(color: Colors.grey, fontSize: 24),
),
),
),
),
解决方案
您可以Opacity
使用black
颜色
像这样 :
color: Colors.black.withOpacity(0.05), //set this opacity as per your requirement
它会看起来更有吸引力
推荐阅读
- .net - 通过命令行在 VS Installer 中启用 NuGet 包管理器。(作为自动化脚本的一部分)
- c - 合并带头节点且不带新节点的排序链表(void 函数)
- c# - 如何在 C# 中从一个项目更改依赖项目的代码
- python - 在python中应用规范化函数时出错
- apache-spark - 将 Spark 数据帧写入 delta Lake
- javascript - 尝试从页面 cookie 设置属性到 chrome 扩展 HTML 我有未定义的状态
- vb.net - 如何获取 Oracle.DataAccess.Client?
- java - 如何在 RestAssured 中发送动态 SOAP XML 请求负载
- excel - VBA-无法通过 REST API 更新 SharePoint 2013 项目
- reactjs - 使用 React hooks 进行文件上传组件