dart - 具有透明背景的颤动角半径
问题描述
下面是我希望渲染具有透明背景的圆角容器的代码。
return new Container(
//padding: const EdgeInsets.all(32.0),
height: 800.0,
//color: const Color(0xffDC1C17),
//color: const Color(0xffFFAB91),
decoration: new BoxDecoration(
color: Colors.green, //new Color.fromRGBO(255, 0, 0, 0.0),
borderRadius: new BorderRadius.only(
topLeft: const Radius.circular(40.0),
topRight: const Radius.circular(40.0))
),
child: new Container(
decoration: new BoxDecoration(
color: Colors.blue,
borderRadius: new BorderRadius.only(
topLeft: const Radius.circular(40.0),
topRight: const Radius.circular(40.0))
),
child: new Center(
child: new Text("Hi modal sheet"),
)
),
然而,这就是它呈现的内容,它呈现一个具有圆角半径的白色容器(预期为透明)。有什么帮助吗?
解决方案
如果你Container
用圆角包裹你的父母,背景颜色设置为Colors.transparent
我认为这就是你想要的。如果您使用的Scaffold
是默认背景颜色,则为白色。将其更改为Colors.transparent
是否达到您想要的。
new Container(
height: 300.0,
color: Colors.transparent,
child: new Container(
decoration: new BoxDecoration(
color: Colors.green,
borderRadius: new BorderRadius.only(
topLeft: const Radius.circular(40.0),
topRight: const Radius.circular(40.0),
)
),
child: new Center(
child: new Text("Hi modal sheet"),
)
),
),
推荐阅读
- android-studio - 在包 name.ratson.cordova.admob 中构建时出错;
- android - 将额外的 Surfaces 传递给 ProcessCameraProvider::bindToLifecycle
- flask - 使用 Flask 上传到 S3 时出现 FileNotFoundError
- vue.js - Vetur 将 .vue 文件的第一行标记为错误
- android - 通过命令行使用gradle构建android应用程序时出错
- javascript - Tiny Slider 2 两排卡片
- javascript - Angular 组件在加载子组件之前不传递数据
- javascript - Angular Ag-Grid:在 Ag Grid 单元格中添加 PrimeNg P-dropdown 作为 html 元素
- firebase - 无法从 firebase 中的文本字段表单中保存数据
- spring-cloud-sleuth - Spring JMS 消费者没有正确设置父跨度 ID