gpt4 book ai didi

flutter - 如何从 ListView 中删除自动 SafeArea?

转载 作者:IT老高 更新时间:2023-10-28 12:42:56 27 4
gpt4 key购买 nike

我刚刚添加了一个 ListView 作为 Scaffold > Stack 的子项,它的顶部似乎有 SafeArea。列不存在这个问题。有什么办法可以去掉吗?

Container(
color: Colors.grey[100],
child: ListView(
children: <Widget>[
Image(
image: snapshot.data.hero,
height: 300.0,
fit: BoxFit.cover,
),
],
),
),

ListView enter image description here

栏目 enter image description here

最佳答案

来自 ListView 文档:

By default, ListView will automatically pad the list's scrollable extremities to avoid partial obstructions indicated by MediaQuery's padding. To avoid this behavior, override with a zero padding property.

所以解决方法是:

ListView(
padding: EdgeInsets.zero,
...
);

关于flutter - 如何从 ListView 中删除自动 SafeArea?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52105557/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com