Flutter 颤振如何创建一个3层堆栈
我需要显示3个容器,但对于一列,但需要显示它们重叠 像这样 正如您在图片中看到的,我需要显示3个小部件图片,然后这将创建一个新的帐户标题,而不是另一个容器 我的代码只是显示了一个图像和最后一个容器,我需要知道如何将这个中间容器添加到图像中Flutter 颤振如何创建一个3层堆栈,flutter,Flutter,我需要显示3个容器,但对于一列,但需要显示它们重叠 像这样 正如您在图片中看到的,我需要显示3个小部件图片,然后这将创建一个新的帐户标题,而不是另一个容器 我的代码只是显示了一个图像和最后一个容器,我需要知道如何将这个中间容器添加到图像中 Stack( children: <Widget>[ Container( padding: EdgeInsets.only(top: statusBarHeight * 0
Stack(
children: <Widget>[
Container(
padding: EdgeInsets.only(top: statusBarHeight * 0.8),
height: height * 0.4,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
'assets/images/place2.jpg',
),
fit: BoxFit.fill,
),
),
),
SingleChildScrollView(
child: Padding(
padding: EdgeInsets.only(top: height * 0.3),
child: SingleChildScrollView(
child: ClipRRect(
borderRadius: BorderRadius.only(
topRight: Radius.circular(30), topLeft: Radius.circular(30)),
child: Container(
decoration: BoxDecoration(
color: Colors.white,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
SizedBox(
height: height * 0.031,
),
Container(
width: width,
margin: EdgeInsets.only(left: 10),
child: Text(
'PLACES',
textAlign: TextAlign.left,
style: TextStyle(fontSize: 30),
),
),
SizedBox(
height: height * 0.02,
),
],
),
),
),
),
),
),
GestureDetector(
onTap: () {
print('back');
},
child: Align(
alignment: Alignment.topLeft,
child: Container(
margin: EdgeInsets.only(left: width * 0.03),
padding: EdgeInsets.only(top: statusBarHeight * 2),
child: Icon(
Icons.arrow_back_ios,
size: 25,
color: Colors.white,
),
),
),
),
],
)
堆栈(
儿童:[
容器(
填充:仅限边缘设置(顶部:statusBarHeight*0.8),
高度:高度*0.4,
装饰:盒子装饰(
图像:装饰图像(
图片:资产评估(
“assets/images/place2.jpg”,
),
fit:BoxFit.fill,
),
),
),
SingleChildScrollView(
孩子:填充(
填充:仅限边缘设置(顶部:高度*0.3),
子:SingleChildScrollView(
孩子:ClipRRect(
borderRadius:仅限borderRadius(
右上:半径。圆形(30),左上:半径。圆形(30)),
子:容器(
装饰:盒子装饰(
颜色:颜色,白色,
),
子:列(
mainAxisSize:mainAxisSize.min,
儿童:[
大小盒子(
高度:高度*0.031,
),
容器(
宽度:宽度,
边距:仅限边距组(左:10),
子:文本(
"地方",,
textAlign:textAlign.left,
样式:TextStyle(字体大小:30),
),
),
大小盒子(
高度:高度*0.02,
),
],
),
),
),
),
),
),
手势检测器(
onTap:(){
打印(“背面”);
},
子对象:对齐(
对齐:alignment.topLeft,
子:容器(
边距:仅限边缘设置(左侧:宽度*0.03),
填充:仅限边缘设置(顶部:statusBarHeight*2),
子:图标(
Icons.arrow\u back\u ios,
尺码:25,
颜色:颜色,白色,
),
),
),
),
],
)
尝试使用“堆栈”小部件。
它类似于一个列,但它的子列堆叠在彼此的顶部。
它在本周的《颤振》小部件上出现
阅读use
Align
withheightFactor
中的用法。作为列的子项
,您可以使用堆栈中的定位小部件来放置项目