flutter_cached_network_image
flutter_cached_network_image copied to clipboard
dynamic cache according to the layout
i tried to combine CachedNetworkImage
with LayoutBuilder
using debugInvertOversizedImages = true
like this:
LayoutBuilder(builder: (context, constraint) {
return CachedNetworkImage(
memCacheHeight:
(constraint.minHeight * devicePixelRatio).round(),
memCacheWidth:
(constraint.minWidth * devicePixelRatio).round(),
filterQuality: FilterQuality.medium,
imageUrl: image,
fit: BoxFit.contain,
progressIndicatorBuilder:
(context, url, downloadProgress) => Center(
child: CircularProgressIndicator(
value: downloadProgress.progress,
),
),
errorWidget: (context, url, error) =>
const SizedBox.shrink(),
);
}
),
But this don't work and return this warning:
Another exception was thrown: Image null has a display size of 673×1328 but a decode size of 1368×2052, which uses an additional 9965KB (assuming a device
pixel ratio of 2)
Do you know how I can pass dynamic values according to the layout for the images cache? thank's