Image constructor
const
Image(
- String src, {
- Key? key,
- bool lazyLoad = false,
- bool cache = false,
- ObjectPosition position = ObjectPosition.center,
- ObjectFit? fit,
- SizeConstraints? size,
- String? alt,
- Color? backgroundColor,
- Gradient? gradient,
- BorderRadiusData? radius,
- EdgeInsets? padding,
- 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,
});