Image constructor
- Key? key,
- required ImageProvider<
Object> image, - ImageFrameBuilder? frameBuilder,
- ImageLoadingBuilder? loadingBuilder,
- ImageErrorWidgetBuilder? errorBuilder,
- String? semanticLabel,
- bool excludeFromSemantics = false,
- double? width,
- double? height,
- Color? color,
- Animation<
double> ? opacity, - BlendMode? colorBlendMode,
- BoxFit? fit,
- AlignmentGeometry alignment = Alignment.center,
- ImageRepeat repeat = ImageRepeat.noRepeat,
- Rect? centerSlice,
- bool matchTextDirection = false,
- bool gaplessPlayback = false,
- bool isAntiAlias = false,
- FilterQuality filterQuality = FilterQuality.medium,
Creates a widget that displays an image.
To show an image from the network or from an asset bundle, consider using Image.network and Image.asset respectively.
The scale
argument specifies the linear scale factor for drawing this
image at its intended size and applies to both the width and the height.
For example, if this is 2.0, it means that there are four image pixels for
every one logical pixel, and the image's actual width and height (as given
by the dart:ui.Image.width and dart:ui.Image.height properties) are
double the height and width that should be used when painting the image
(e.g. in the arguments given to Canvas.drawImage).
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.
Use filterQuality
to specify the rendering quality of the image.
If excludeFromSemantics
is true, then semanticLabel
will be ignored.
Implementation
const Image({
super.key,
required this.image,
this.frameBuilder,
this.loadingBuilder,
this.errorBuilder,
this.semanticLabel,
this.excludeFromSemantics = false,
this.width,
this.height,
this.color,
this.opacity,
this.colorBlendMode,
this.fit,
this.alignment = Alignment.center,
this.repeat = ImageRepeat.noRepeat,
this.centerSlice,
this.matchTextDirection = false,
this.gaplessPlayback = false,
this.isAntiAlias = false,
this.filterQuality = FilterQuality.medium,
});