Language: English| 中文简体
Automatically adjust the image cache size based on the size of the widget.
Supports various types of ImageProviders including NetworkImage
, AssetImage
, FileImage
, etc.
Supports CachedNetworkImageProvider
debugInvertOversizedImages = false | debugInvertOversizedImages = true |
---|---|
auto_resize_image:1.0.0
SizedBox(
width: 200,
height: 200,
child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
return Image(
fit: BoxFit.cover,
image: AutoResizeImage(
imageProvider: CachedNetworkImageProvider(url),
width: constraints.maxWidth,
height: constraints.maxHeight,
),
);
},
),
),
The green box represents the size of the widget, while the red box represents the size of the image cache.
ResizeMode | Illustration | Clarity/Memory Usage | Oversized |
---|---|---|---|
contain | Low | No | |
balance | Medium | No | |
cover | High | Yes |