【发布时间】:2019-12-27 16:24:57
【问题描述】:
我正在尝试制作如下图所示的小部件。
我的心态是将项目堆叠到列表视图中。物品是堆叠的。但是当将堆栈嵌套到listview中时,堆栈需要被包裹在一个固定的小部件中。如果您删除列表视图,则无法将其放入列表中,如图所示。第一次期望人们忽略并没有错。
我希望得到答案。谢谢。
body: Container(
color: Colors.white,
width: double.infinity,
child: SingleChildScrollView(
child: Stack(
children: <Widget>[
Positioned(top: 10,child: card1(),),
Positioned(bottom: 10,child: card1(),),
],
),
),
),
物品
static Widget card1() {
return Card(
elevation: 0,
child: Container(
margin: EdgeInsets.only(top: 100),
width: double.infinity,
padding: EdgeInsets.only(top: 18, left: 18),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(offset: Offset(0, 8), blurRadius: 8, spreadRadius: 0),
],
),
child: Stack(
children: <Widget>[
Container(
width: 343,
height: 196,
child: SvgPicture.asset(
"assets/bg.svg",
),
),
Container(
padding: EdgeInsets.only(
top: 24,
left: 24,
),
child: Row(
children: <Widget>[
Container(
padding: EdgeInsets.only(left: 10),
child: Text("Vietcombank"),
),
],
),
),
],
),
),
);
}
【问题讨论】: