我花了几个小时在颤振中创建一个可重用的小部件。我的预期结果是这样的:
但我坚持根据它的父母来填充不透明度宽度,如下所示:
这是我尝试过的代码:
Stack(
children: <Widget>[
Container(
padding: const EdgeInsets.all(12),
child: Image.network(
"https://raw.githubusercontent.com/flutter/website/master/examples/layout/lakes/step5/images/lake.jpg",
fit: BoxFit.cover
)
),
Positioned(
left: 15,
bottom: 15,
child: Container(
decoration: BoxDecoration(
color: Color.fromRGBO(0, 0, 0, 0.5)
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Text("TITLE", style: new TextStyle(fontSize: 28, color: Colors.white)),
new Text("Sub Title", style: new TextStyle(fontSize: 20, color: Colors.white))
],
),
FlatButton(
color: Colors.red[400],
highlightColor: Colors.red[900],
onPressed: (){},
child: new Text("Book Now", style: new TextStyle(fontSize: 28, color: Colors.white)),
)
],
),
)
)
],
)
有什么建议吗?