我尝试使用具有不透明度的深色背景进行相机预览,并且在中间部分具有卡片区域,其具有透明背景。它看起来像是在深色背景的移动设备中显示Dialog,但对话框在深色背景下具有透明背景。
我已经完成了使用列和行小部件,例如:
Column(
children : <Widget>[
Expanded(
child: Container(
color: Colors.Black54
)
),
Row(
children : <Widget>[
Expanded(
child: Container(
color: Colors.Black54
)
),
CardWidget(
width: cardWidth,
height: cardHeight,
Color: Colors.Transparent
),
Expanded(
child: Container(
color: Colors.Black54
)
),
]
),
Expanded(
child: Container(
color: Colors.Black54
)
),
]
)
但我想知道有一个简单的方法,如:
Container(
color: Colors.Black54,
child: center(
child: CardWidget(
width: cardWidth,
height: cardHeight,
background: Colors.Transparent
)
)
)
如果有其他方法可以像上面的代码一样简单,请告诉我。谢谢
你想做这样的事吗?
如果是,这是代码:
new Container(
decoration: new BoxDecoration(
border: Border(
top: BorderSide(width: 300, color: Colors.grey[700]),
left: BorderSide(width: 100, color: Colors.grey[700]),
right: BorderSide(width: 100, color: Colors.grey[700]),
bottom: BorderSide(width: 300, color: Colors.grey[700]),
),
color: Colors.transparent),
)