Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MohsinIkram-Auxilium opened this issue Nov 29, 2024 · 0 comments

Comments

@MohsinIkram-Auxilium
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant