Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

How can i hide the CachedNetworkImage if there is an image issue.

未关闭
#992 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 4 天内回复

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
25/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
dart, flutter
领域
mobile

调研方向

该 issue 提供了一个 CachedNetworkImage 的内联示例;请先检查其 errorWidget 回调以及周围的列表项布局。完成的标准是确定列表项在 404 之后的行为,同时不留下固定高度的空框。

由索引模型根据 Issue 内容生成。

描述

Hi, Your package is working great.
I just have a one question.
I'm showing the big images in the list view. I need help and suggestions.
Basically there are some urls in the listview which have no images like they throw 404 error. And I'm handling these errors and showing the default images at the place of 404 images.

But now I want to hide the whole CachedNetworkImage on error instead of showing a place holder image.
Here is my code

CachedNetworkImage( width: double.maxFinite, fit: BoxFit.fill, height: 200, imageUrl: widget.model?.getPictureUrl ?? "", progressIndicatorBuilder: (context, url, downloadProgress) => Container( color: Colors.white, child: Center( child: Padding( padding: const EdgeInsets.all(4.0), child: CircularProgressIndicator(value: downloadProgress.progress), ))), errorWidget: (context, url, error) => SizedBox.shrink())

Currently is showing an empty box but the box height is 200 so its looks bad.
So my main concern is i need to hide full CachedNetworkImage in the listview with best approach.
Can anyone please guide and help me.
Thanks

主要语言
Dart
星标
2.6k
派生
731
平均合并
4 天 12 小时
30 天内合并 PR
2

环境准备

我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Baseflow/flutter_cached_network_image 的其他 Issue

查看 Baseflow/flutter_cached_network_image 的全部 Issue

相似的 Issue

更多 Dart Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。