【问题标题】:Flutter web Image loading in mobile view, but not in full view?Flutter web 图片在移动视图中加载,但不是全视图?
【发布时间】:2021-05-09 15:50:26
【问题描述】:

我正在使用 FadeInImage 小部件从网络加载图像

当页面在开发者控制台的移动视图中刷新时,图像加载正常,但在全视图中它给了我一个异常

The following ImageCodecException was thrown resolving an image codec:
Failed to load network image.
Image URL: https://api.gogoz.in/static/img/FF000001FV0000007.jpg
Trying to load an image from another domain? Find answers at:
https://flutter.dev/docs/development/platform-integration/web-images

When the exception was thrown, this was the stack:
...

Image provider: NetworkImage("https://api.gogoz.in/static/img/FF000001FV0000007.jpg", scale: 1)
Image key: NetworkImage("https://api.gogoz.in/static/img/FF000001FV0000007.jpg", scale: 1)

【问题讨论】:

    标签: image flutter widget flutter-web


    【解决方案1】:

    问题:

    似乎在最新的 Beta 版本 1.26(2021 年 2 月)中,默认的 renderer 似乎已从 html 切换到 canvaskit

    修复:

    Web 中工作时,使用html 渲染器而不是canvaskit。方法如下:

    • 如果您从命令行“运行”,请使用以下命令:

    flutter run -d chrome --web-renderer html

    • 如果您使用 Android Studio:转到Run/ Run.../ Edit Configurations.../,然后在Additional arguments 中添加此--web-renderer html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-20
      • 2014-04-08
      相关资源
      最近更新 更多