Baseflow / Baseflow/flutter_cached_network_image

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

Open
#992 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
2.6k
Forks
731
Avg merge
3d 9h
Merged PRs (30d)
1

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue provides an inline CachedNetworkImage example; start by reviewing its errorWidget callback and the surrounding list-item layout. Done means determining how the list item behaves after a 404 without leaving the fixed-height empty box.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
mobile
Issue type
Feature
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.