flutter_cached_network_image icon indicating copy to clipboard operation
flutter_cached_network_image copied to clipboard

Using memCacheWidth/height along with imageBuilder has no effect.

Open irjayjay opened this issue 3 years ago • 1 comments

🐛 Bug Report

When adding a memCacheWidth or memCacheHeight, the cached version of the image doesn't get passed to the imageBuilder, so the image stays its original size.

When using debugInvertOversizedImages = true; the image is clearly still too large for its container. Removing the imageBuilder fixes this error.

Expected behavior

Image rendered through the imageBuilder should be lower resolution or smaller size.

Reproduction steps

Run the following with an image:

CachedNetworkImage(
                  imageUrl: imageUrl.toString(),
                  memCacheWidth: 50,
                  imageBuilder: (context, imageProvider) {
                    return Container(
                      width: double.infinity,
                      height: 150,
                      decoration: BoxDecoration(
                        image: DecorationImage(
                          image: imageProvider,
                          fit: BoxFit.cover,
                        ),
                      ),
                    );
                  },
                ),
                

Configuration

As above.

Version: 3.2.0

Platform:

  • [ ] :iphone: iOS
  • [X] :robot: Android

irjayjay avatar Aug 29 '22 15:08 irjayjay

🐛 Bug Report

When adding a memCacheWidth or memCacheHeight, the cached version of the image doesn't get passed to the imageBuilder, so the image stays its original size.

When using debugInvertOversizedImages = true; the image is clearly still too large for its container. Removing the imageBuilder fixes this error.

Expected behavior

Image rendered through the imageBuilder should be lower resolution or smaller size.

Reproduction steps

Run the following with an image:

CachedNetworkImage(
                  imageUrl: imageUrl.toString(),
                  memCacheWidth: 50,
                  imageBuilder: (context, imageProvider) {
                    return Container(
                      width: double.infinity,
                      height: 150,
                      decoration: BoxDecoration(
                        image: DecorationImage(
                          image: imageProvider,
                          fit: BoxFit.cover,
                        ),
                      ),
                    );
                  },
                ),
                

Configuration

As above.

Version: 3.2.0

Platform:

  • [ ] 📱 iOS
  • [x] 🤖 Android

Hi bro ! You can try update version to cached_network_image: ^3.2.2

ZephHe avatar Sep 02 '22 09:09 ZephHe

Yes, it's because the image provider we are receiving is not applying the ResizeImage. I believe the implementation of imageBuilder on this package needs to be refactored, to make sure that we will receive the image based on the CachedNetworkImage settings

lubritto avatar Jan 30 '23 15:01 lubritto