【问题标题】:Flutter CachedNetworkImage doesn't work, loading images again when scrolling up to bottom or bottom to upFlutter CachedNetworkImage 不起作用,向上滚动到底部或从底部向上滚动时再次加载图像
【发布时间】:2019-09-24 03:49:29
【问题描述】:

我正在尝试使用缓存的图像。我关注了CachedNetworkImage,但它不起作用。如果有任何其他可用的解决方案,请帮助我

Here is video of my issue

当我从上到下或从下到上滚动列表时,图像消失并再次重新加载

代码

        ClipRRect(
                  borderRadius: new BorderRadius.only(
                  topRight: Radius.circular(10.0),
                  topLeft: Radius.circular(10.0)),
                  child: CachedNetworkImage(
                       placeholder: (context, url) => Center(
                           child: CircularProgressIndicator(),),
                            imageUrl: productList[position]["images"]
                            ["post_image1"],
                            height: 180,
                            width: MediaQuery.of(context).size.width,
                            fit: BoxFit.cover,
                    ))

【问题讨论】:

  • 我在某处读到这个插件现在不是那么有效。
  • 还有其他选择吗?

标签: flutter dart lazy-loading image-loading


【解决方案1】:

CachedNetworkImage 对我来说很好用。

在模拟器/模拟器上运行您的应用,然后您可以查看图像是否已被缓存。 请注意,图像大小有很大的不同(您不希望它们超过 100K 并且希望

总之,请确保图片大小适合在移动应用中使用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-06-15
    • 1970-01-01
    • 1970-01-01
    • 2015-02-24
    • 2014-12-12
    • 2011-08-26
    • 1970-01-01
    相关资源
    最近更新 更多