Baseflow / Baseflow/flutter_cached_network_image

dynamic cache according to the layout

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

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the reported LayoutBuilder and CachedNetworkImage configuration with debugInvertOversizedImages enabled. Check whether the cache dimensions follow the layout constraints and determine what repository change, if any, would address the reported decode-size warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
mobile-dev, performance
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.