Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2f15554
Add useLogicalPixels to ResizeImage for logical pixel cache sizing
koji-1009 Apr 2, 2026
00a4e2f
Add dartdoc
koji-1009 Apr 3, 2026
683426a
Always scale by devicePixelRatio in ResizeImage
koji-1009 Apr 26, 2026
d5a26bb
Merge branch 'main' into feat/image_device_pixel_ratio_cache
koji-1009 Apr 26, 2026
4ebb86f
Merge branch 'master' into feat/image_device_pixel_ratio_cache
justinmc Apr 29, 2026
7c19dfe
Revert "Always scale by devicePixelRatio in ResizeImage"
koji-1009 Apr 30, 2026
332dab8
Refactor ResizeImage and update FadeInImage
koji-1009 Apr 30, 2026
a6c4457
Drop unrelated cacheWidth doc reflow
koji-1009 May 1, 2026
33d73e2
Add use-case comment
koji-1009 May 1, 2026
c3b34d1
Refactor ResizeImageKey
koji-1009 May 1, 2026
bca9e56
Add test
koji-1009 May 6, 2026
0068006
dart format
koji-1009 May 6, 2026
4290474
Merge branch 'master' into feat/image_device_pixel_ratio_cache
victorsanni May 8, 2026
70921da
Add ignore comment
koji-1009 May 10, 2026
f5c76da
Rename useLogicalPixels to useLogicalSize and document pixel type
koji-1009 May 14, 2026
feae619
Merge branch 'master' into feat/image_device_pixel_ratio_cache
koji-1009 May 14, 2026
8f891e1
Merge branch 'master' into feat/image_device_pixel_ratio_cache
koji-1009 May 15, 2026
ad9d840
dart format
koji-1009 May 15, 2026
735b911
Expand useLogicalSize dartdoc and share via @macro
koji-1009 May 30, 2026
8951079
Merge branch 'main' into feat/image_device_pixel_ratio_cache
koji-1009 May 30, 2026
8d67b19
Merge branch 'master' into feat/image_device_pixel_ratio_cache
koji-1009 Aug 12, 2026
cb98425
Merge branch 'master' into feat/image_device_pixel_ratio_cache
victorsanni Aug 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add use-case comment
  • Loading branch information
koji-1009 committed May 1, 2026
commit 33d73e2165b0e6f790cf30d09fcdd8382c5ba73c
3 changes: 3 additions & 0 deletions packages/flutter/lib/src/painting/image_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,9 @@ class ResizeImage extends ImageProvider<ResizeImageKey> {

/// Whether [width] and [height] are interpreted as logical pixels rather
/// than physical pixels.
///

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done here as well in 735b911.

/// Set this to true when [width] and [height] describe the image's on-screen
/// size in logical pixels.
final bool useLogicalPixels;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we also want to call this out in the docs for width and height. And also in their docs specify what type of pixels is used for them.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specified the pixel type in f5c76da.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Maybe rename to useLogicalSize to match useLogicalCacheSize? Just a thought, up to you.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to useLogicalSize in f5c76da.


/// Composes the `provider` in a [ResizeImage] only when `cacheWidth` and
Expand Down
10 changes: 6 additions & 4 deletions packages/flutter/lib/src/widgets/fade_in_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ class FadeInImage extends StatefulWidget {
/// intended to reduce the memory usage of [ImageCache].
///
/// If [useLogicalCacheSize] is true, the cache dimensions are interpreted
/// as logical pixels instead of physical pixels. The flag applies to both
/// the placeholder and the image.
/// as logical pixels instead of physical pixels. Set this to true when
/// the cache dimensions describe the image's on-screen size in logical
/// pixels. The flag applies to both the placeholder and the image.
///
/// The [placeholder], [image], [placeholderScale], [imageScale],
/// [fadeOutDuration], [fadeOutCurve], [fadeInDuration], [fadeInCurve],
Expand Down Expand Up @@ -198,8 +199,9 @@ class FadeInImage extends StatefulWidget {
/// intended to reduce the memory usage of [ImageCache].
///
/// If [useLogicalCacheSize] is true, the cache dimensions are interpreted
/// as logical pixels instead of physical pixels. The flag applies to both
/// the placeholder and the image.
/// as logical pixels instead of physical pixels. Set this to true when
/// the cache dimensions describe the image's on-screen size in logical
/// pixels. The flag applies to both the placeholder and the image.
///
/// See also:
///
Expand Down
16 changes: 12 additions & 4 deletions packages/flutter/lib/src/widgets/image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,9 @@ class Image extends StatefulWidget {
/// to reduce the memory usage of [ImageCache].
///
/// If [useLogicalCacheSize] is true, [cacheWidth] and [cacheHeight] are
/// interpreted as logical pixels instead of physical pixels.
/// interpreted as logical pixels instead of physical pixels. Set this to
/// true when [cacheWidth] and [cacheHeight] describe the image's on-screen
/// size in logical pixels.
///
/// In the case where the network image is on the Web platform, the [cacheWidth]
/// and [cacheHeight] parameters are ignored as the web engine delegates
Expand Down Expand Up @@ -511,7 +513,9 @@ class Image extends StatefulWidget {
/// to reduce the memory usage of [ImageCache].
///
/// If [useLogicalCacheSize] is true, [cacheWidth] and [cacheHeight] are
/// interpreted as logical pixels instead of physical pixels.
/// interpreted as logical pixels instead of physical pixels. Set this to
/// true when [cacheWidth] and [cacheHeight] describe the image's on-screen
/// size in logical pixels.
///
/// Loading an image from a file creates an in memory copy of the file,
/// which is retained in the [ImageCache]. The underlying file is not
Expand Down Expand Up @@ -600,7 +604,9 @@ class Image extends StatefulWidget {
/// to reduce the memory usage of [ImageCache].
///
/// If [useLogicalCacheSize] is true, [cacheWidth] and [cacheHeight] are
/// interpreted as logical pixels instead of physical pixels.
/// interpreted as logical pixels instead of physical pixels. Set this to
/// true when [cacheWidth] and [cacheHeight] describe the image's on-screen
/// size in logical pixels.
///
/// Either the [width] and [height] arguments should be specified, or the
/// widget should be placed in a context that sets tight layout constraints.
Expand Down Expand Up @@ -759,7 +765,9 @@ class Image extends StatefulWidget {
/// to reduce the memory usage of [ImageCache].
///
/// If [useLogicalCacheSize] is true, [cacheWidth] and [cacheHeight] are
/// interpreted as logical pixels instead of physical pixels.
/// interpreted as logical pixels instead of physical pixels. Set this to
/// true when [cacheWidth] and [cacheHeight] describe the image's on-screen
/// size in logical pixels.
Image.memory(
Uint8List bytes, {
super.key,
Expand Down
Loading