ResizeImage constructor
- ImageProvider<
Object> imageProvider, { - int? width,
- int? height,
- ResizeImagePolicy policy = ResizeImagePolicy.exact,
- bool allowUpscaling = false,
- bool useLogicalSize = false,
Creates an ImageProvider that decodes the image to the specified size.
The cached image will be directly decoded and stored at the resolution
defined by width and height. The image will lose detail and
use less memory if resized to a size smaller than the native size.
At least one of width and height must be non-null.
Whether width and height are interpreted as logical pixels.
When false (the default), width and height are treated as physical
pixels. On high-density displays, this can result in images being decoded
at fewer pixels than the screen can render, producing lower-quality output.
When true, width and height are multiplied by the device pixel ratio
from the current ImageConfiguration, so the image is decoded at the
resolution that matches the rendered display.
Typically in the framework, pixel dimensions are interpreted as logical rather than physical. However, this defaults to physical for backwards compatibility.
Implementation
const ResizeImage(
this.imageProvider, {
this.width,
this.height,
this.policy = ResizeImagePolicy.exact,
this.allowUpscaling = false,
this.useLogicalSize = false,
}) : assert(width != null || height != null);