/auto_resize_image

Automatically adjust the image cache size based on the size of the widget.

Primary LanguageC++MIT LicenseMIT

AutoResizeImage

pub package

Language: English| 中文简体

Automatically adjust the image cache size based on the size of the widget.

Features

Supports various types of ImageProviders including NetworkImage, AssetImage, FileImage, etc.

Supports CachedNetworkImageProvider

debugInvertOversizedImages = false debugInvertOversizedImages = true
Screenshot_20240227-183452.jpg Screenshot_20240228-095622.jpg

Usage

pub package

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,
        ),
      );
    },
  ),
),

Additional information

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 20240227_165706.jpg Medium No
cover 20240227_165733.jpg High Yes