Image.file constructor
Creates a widget that displays an ImageStream obtained from a File.
The file
, scale
, and repeat
arguments must not be null.
Either the width
and height
arguments should be specified, or the
widget should be placed in a context that sets tight layout constraints.
Otherwise, the image dimensions will change as the image is loaded, which
will result in ugly layout changes.
On Android, this may require the
android.permission.READ_EXTERNAL_STORAGE
permission.
Use filterQuality
to change the quality when scaling an image.
Use the FilterQuality.low quality setting to scale the image,
which corresponds to bilinear interpolation, rather than the default
FilterQuality.none which corresponds to nearest-neighbor.
If excludeFromSemantics
is true, then semanticLabel
will be ignored.
Implementation
Image.file(File file, {
Key key,
double scale = 1.0,
this.semanticLabel,
this.excludeFromSemantics = false,
this.width,
this.height,
this.color,
this.colorBlendMode,
this.fit,
this.alignment = Alignment.center,
this.repeat = ImageRepeat.noRepeat,
this.centerSlice,
this.matchTextDirection = false,
this.gaplessPlayback = false,
this.filterQuality = FilterQuality.low,
}) : image = FileImage(file, scale: scale),
assert(alignment != null),
assert(repeat != null),
assert(filterQuality != null),
assert(matchTextDirection != null),
super(key: key);