【发布时间】:2020-02-04 01:49:43
【问题描述】:
我正在用 Flutter 开发一个新应用,但是当有一些图像比屏幕高时,图像就会消失。
我正在使用最新版本的 Flutter/Dart。 我尝试将 cacheExtent 添加到 ListView,但没有任何改变。 扑医生:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.9.1+hotfix.4, on Microsoft Windows [Versione 10.0.18362.356], locale it-IT)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Android Studio (version 3.5)
[√] VS Code (version 1.38.1)
[√] Connected device (1 available)
• No issues found!
@override
Widget build(BuildContext context) {
final double width = MediaQuery.of(context).size.width;
super.build(context);
return ListView(
children: <Widget>[
Image.network('https://wallpaperaccess.com/full/11740.jpg', width: width, height: width, fit: BoxFit.cover,),
Image.network('https://wallpaperaccess.com/full/11740.jpg', width: width, height: width, fit: BoxFit.cover,),
Image.network('https://wallpaperaccess.com/full/11740.jpg', width: width, height: width, fit: BoxFit.cover,),
...
],
);
}
【问题讨论】:
-
添加一些截图。代码工作正常。我什至加载了一个很长的图像。它按预期工作。
-
好的,我加了。