flutter - 无法将容器放在可滚动的 sliverlist 内的堆栈中
问题描述
无法将容器放在可滚动银色列表内的堆栈中。我的代码是
SliverList(
delegate: SliverChildListDelegate([
Stack(
children: [
Container(
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.cover,
image: NetworkImage(
'https://idsb.tmgrup.com.tr/ly/uploads/images/2020/05/13/35552.jpeg'))),
height: createSize(347, context),
width: createSize(375, context),
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
color: Colors.blue,
height: createSize(307, context),
),
),
],
)
])
解决方案
将您的 SliverList 放在 CustomScrollView 中,如下所示:
return CustomScrollView(
slivers: [
SliverList(
delegate: SliverChildListDelegate([
Stack(
children: [
Container(
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.cover,
image: NetworkImage(
'https://idsb.tmgrup.com.tr/ly/uploads/images/2020/05/13/35552.jpeg'))),
height: createSize(347, context),
width: createSize(375, context),
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
color: Colors.blue,
height: createSize(307, context),
),
),
],
)
]),
),
],
);
推荐阅读
- vb6 - 如何将文本框从其他表单连接到其他表单的数据网格
- javascript - CKEditor 5 自定义按钮在 Vue.js 组件中失败
- arrays - 如何使用 POST Flutter 解析嵌套的 Json
- php - PHP IMAP_SEARCH 语法 UNSEEN、SINCE、RECENT,产生意想不到的结果
- powershell - 信息记录被打印两次
- .net-core - GitlabCI不使用变量
- spring-integration - 如何使用spring集成kafka确认消费者读取的kafka消息
- php - Silverstrip 单元测试fixture_file 不工作
- python - Python如何在电子邮件正文中将多个数据帧作为HTML表格发送
- c - 为什么子进程“读取”函数不返回(我认为它会返回-1),子进程“printf”函数不起作用