【发布时间】:2018-05-07 13:23:46
【问题描述】:
我正在尝试实现这一点(Todo 图像),但图像被隐藏了。如何把它放在上面?我认为使用 Stack 会自动将其置于首位。有没有等效的z-index?我也分享了下面的代码
待办事项
进行中
代码
Widget build(BuildContext context) {
return new Scaffold(
body: new CustomScrollView(
slivers: <Widget>[
new SliverAppBar(
expandedHeight: 150.0,
flexibleSpace: new FlexibleSpaceBar(
background: new Stack(
alignment: new Alignment(0.0, 2.5),
children: [
new Container(
margin: const EdgeInsets.symmetric(vertical: 40.0),
decoration: new BoxDecoration(
image: new DecorationImage(
image: new AssetImage("images/Theme-pattern.png"))),
child: new Column(children: <Widget>[
new Text("Title", style: new TextStyle(fontSize: 32.0)),
]),
),
new Container(
decoration: new BoxDecoration(
borderRadius:
new BorderRadius.all(const Radius.circular(120.0)),
color: Colors.white),
width: 100.0,
child: new Image.asset("images/photo.png"),
)
],
),
),
),
],
));
}
【问题讨论】:
-
“堆栈会自动将其置于顶部”是什么意思?将小部件添加到数组的顺序定义了哪个在其他之上或之下。
标签: flutter