gpt4 book ai didi

flutter - 如何在状态栏后面绘制 ListView 而无需填充?

转载 作者:行者123 更新时间:2023-12-03 02:54:40 25 4
gpt4 key购买 nike

这是我要实现的目标:
The scaffold content is behind the status bar
这就是我现在所拥有的:

  @override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
body: ListView(
children: [
Image.asset(
'assets/images/videosbg.png',
fit: BoxFit.cover,
height: 300,
width: double.infinity,
),
...
],
),
);
}
The scaffold content is below the status bar
我不想删除状态栏或更改其颜色,因此SystemChrome对我不起作用。
如何将脚手架放在状态栏后面而不是下方?我是否需要以某种方式删除状态栏的上部填充?

最佳答案

ListView具有padding属性,请将其设置为EdgeInsets.zero

  @override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
body: ListView(
padding: EdgeInsets.zero,
children: [
Image.asset(
'assets/images/videosbg.png',
fit: BoxFit.cover,
height: 300,
width: double.infinity,
),
...
],
),
);
}
仅供引用 https://github.com/flutter/flutter/issues/14842

关于flutter - 如何在状态栏后面绘制 ListView 而无需填充?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64077662/

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