ResponsiveImage.file constructor
- File file, {
- Key? key,
- double scale = 1.0,
- dynamic frameBuilder,
- dynamic errorBuilder,
- dynamic semanticLabel,
- dynamic excludeFromSemantics = false,
- dynamic width,
- dynamic height,
- dynamic color,
- dynamic opacity,
- dynamic colorBlendMode,
- dynamic fit,
- dynamic alignment = Alignment.center,
- dynamic repeat = ImageRepeat.noRepeat,
- dynamic centerSlice,
- dynamic matchTextDirection = false,
- dynamic gaplessPlayback = false,
- dynamic isAntiAlias = false,
- dynamic filterQuality = FilterQuality.low,
- int? cacheWidth,
- int? cacheHeight,
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 specify the rendering quality of the image.
If excludeFromSemantics is true, then semanticLabel will be ignored.
If cacheWidth or cacheHeight are provided, it indicates to the
engine that the image must be decoded at the specified size. The image
will be rendered to the constraints of the layout or width and height
regardless of these parameters. These parameters are primarily intended
to reduce the memory usage of ImageCache.
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 monitored for changes. If it does change, the application should evict the entry from the ImageCache.
See also:
- FileImage provider for evicting the underlying file easily.
Implementation
ResponsiveImage.file(
File file, {
Key? key,
double scale = 1.0,
frameBuilder,
errorBuilder,
semanticLabel,
excludeFromSemantics = false,
width,
height,
color,
opacity,
colorBlendMode,
fit,
alignment = Alignment.center,
repeat = ImageRepeat.noRepeat,
centerSlice,
matchTextDirection = false,
gaplessPlayback = false,
isAntiAlias = false,
filterQuality = FilterQuality.low,
int? cacheWidth,
int? cacheHeight,
}) : super() {
set('key', key)
.set('imageType', _ImageType.fileImage)
.set('file', file)
.set('scale', scale)
.set('frameBuilder', frameBuilder)
.set('errorBuilder', errorBuilder)
.set('semanticLabel', semanticLabel)
.set('excludeFromSemantics', excludeFromSemantics)
.set('width', width)
.set('height', height)
.set('color', color)
.set('opacity', opacity)
.set('colorBlendMode', colorBlendMode)
.set('fit', fit)
.set('alignment', alignment)
.set('repeat', repeat)
.set('centerSlice', centerSlice)
.set('matchTextDirection', matchTextDirection)
.set('gaplessPlayback', gaplessPlayback)
.set('isAntiAlias', isAntiAlias)
.set('filterQuality', filterQuality)
.set('cacheWidth', cacheWidth)
.set('cacheHeight', cacheHeight);
}