StacImage class

A Stac widget that displays an image.

This widget corresponds to Flutter's Image widget and can display images from various sources including assets, network, and files.

{@tool snippet} Dart Example:

const StacImage(
  src: 'assets/logo.png',
  width: 200,
  height: 100,
  fit: StacBoxFit.cover,
)

{@end-tool}

{@tool snippet} JSON Example:

{
  "type": "image",
  "src": "assets/logo.png",
  "width": 200,
  "height": 100,
  "fit": "cover"
}

{@end-tool}

Inheritance
Annotations
  • @JsonSerializable.new()

Constructors

StacImage({required String src, StacAlignment? alignment, StacImageType? imageType, StacColor? color, double? width, double? height, StacBoxFit? fit, StacImageRepeat? repeat, StacFilterQuality? filterQuality, String? semanticLabel, bool? excludeFromSemantics})
Creates an image widget with the specified source and options.
const
StacImage.asset(String path, {StacAlignment? alignment, StacColor? color, double? width, double? height, StacBoxFit? fit, StacImageRepeat? repeat, StacFilterQuality? filterQuality, String? semanticLabel, bool? excludeFromSemantics})
Creates an image widget that loads from application assets.
const
StacImage.file(String path, {StacAlignment? alignment, StacColor? color, double? width, double? height, StacBoxFit? fit, StacImageRepeat? repeat, StacFilterQuality? filterQuality, String? semanticLabel, bool? excludeFromSemantics})
Creates an image widget that loads from a local file path.
const
StacImage.fromJson(Map<String, dynamic> json)
Creates a StacImage from a JSON map.
factory
StacImage.network(String url, {StacAlignment? alignment, StacColor? color, double? width, double? height, StacBoxFit? fit, StacImageRepeat? repeat, StacFilterQuality? filterQuality, String? semanticLabel, bool? excludeFromSemantics})
Creates an image widget that loads from a network URL.
const

Properties

alignment → StacAlignment?
How to align the image within its bounds.
final
color → StacColor?
A color filter to apply to the image.
final
excludeFromSemantics → bool?
Whether to exclude this image from semantics.
final
filterQuality → StacFilterQuality?
The quality level for image filtering operations.
final
fit → StacBoxFit?
How the image should be inscribed into the space allocated during layout.
final
hashCode → int
The hash code for this object.
no setterinherited
height → double?
The height of the image in logical pixels.
final
imageType → StacImageType?
The type of image source (asset, network, etc.).
final
jsonData → Map<String, dynamic>?
Raw JSON data for this widget
finalinherited
repeat → StacImageRepeat?
How the image should be repeated if it doesn't fill its layout bounds.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
semanticLabel → StacColor?
A semantic description of the image for accessibility.
final
src → String
The source path or URL of the image to display.
final
type → String
The type of the widget
no setteroverride
width → double?
The width of the image in logical pixels.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
Converts this widget to a JSON map
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited