Image constructor

const Image(
  1. String src, {
  2. Key? key,
  3. bool lazyLoad = false,
  4. bool cache = false,
  5. ObjectPosition position = ObjectPosition.center,
  6. ObjectFit? fit,
  7. SizeConstraints? size,
  8. String? alt,
  9. Color? backgroundColor,
  10. Gradient? gradient,
  11. BorderRadiusData? radius,
  12. EdgeInsets? padding,
  13. String? classes,
})

A component that displays an image.

Example

Image(
  'https://example.com/image.png',
  alt: 'Image',
  size: SizeConstraints(
    width: Dim.px(100),
    height: Dim.px(100),
  ),
  cache: true,
  lazyLoad: true,
  fit: ObjectFit.cover,
)

Implementation

const Image(
  this.src, {
  super.key,
  this.lazyLoad = false,
  this.cache = false,
  this.position = ObjectPosition.center,
  this.fit,
  this.size,
  this.alt,
  this.backgroundColor,
  this.gradient,
  this.radius,
  this.padding,
  this.classes,
});