Image widget allows you to display an image in your Flutter app using JSON. It supports images from multiple sources, including assets, files, and network URLs, and provides customization options such as alignment, color, width, height, and fit.
To learn more about the equivalent Flutter widgets and their properties, refer to the official Flutter documentation for Image.
Properties
| Property | Type | Description |
|---|---|---|
src | String | The source path or URL of the image to display. |
alignment | StacAlignment | How to align the image within its bounds. |
imageType | StacImageType | The type of image source: asset, network, or file. |
color | StacColor | A color filter to apply to the image. |
width | double | The width of the image in logical pixels. |
height | double | The height of the image in logical pixels. |
fit | StacBoxFit | How the image should be inscribed into the space allocated during layout. |
repeat | StacImageRepeat | How the image should be repeated if it doesn’t fill its layout bounds. |
filterQuality | StacFilterQuality | The quality level for image filtering operations. |
semanticLabel | String | A semantic description of the image for accessibility. |
excludeFromSemantics | bool | Whether to exclude this image from semantics. |
Constructors
StacImage.asset
Creates an image widget that loads from Flutter’s asset bundle.StacImage.network
Creates an image widget that loads from a network URL.StacImage.file
Creates an image widget that loads from a local file path.StacImage (Default)
The default constructor allows you to specify any image source with theimageType property.