BloomImage constructor
BloomImage({
- required String src,
- String? alt,
- bool decorative = false,
- int? width,
- int? height,
- String? aspectRatio,
- List<
int> ? widths, - String? sizes,
- ImageUrlBuilder? urlBuilder,
- ImageLoading loading = ImageLoading.lazy,
- ImageDecoding decoding = ImageDecoding.async,
- FetchPriority? fetchPriority,
- bool priority = false,
- String? placeholder,
- String? fallbackSrc,
- ImageFit? fit,
- String? className,
- String? style,
- Map<
String, String> ? attrs, - BloomEventHandler? onClick,
- BloomEventHandler? onLoad,
- BloomEventHandler? onError,
- Ref<
Object> ? ref,
Creates a responsive image descriptor with layout stability, lazy loading, accessibility checks, and placeholder styling.
Implementation
BloomImage({
required String src,
String? alt,
bool decorative = false,
int? width,
int? height,
String? aspectRatio,
List<int>? widths,
String? sizes,
ImageUrlBuilder? urlBuilder,
ImageLoading loading = ImageLoading.lazy,
ImageDecoding decoding = ImageDecoding.async,
FetchPriority? fetchPriority,
bool priority = false,
String? placeholder,
String? fallbackSrc,
ImageFit? fit,
super.className,
String? style,
Map<String, String>? attrs,
BloomEventHandler? onClick,
BloomEventHandler? onLoad,
BloomEventHandler? onError,
Ref<Object>? ref,
}) : super(
'img',
style: _buildImageStyle(
style: style,
placeholder: placeholder,
aspectRatio: aspectRatio,
fit: fit,
),
attrs: _buildImageAttrs(
src: src,
alt: alt,
decorative: decorative,
width: width,
height: height,
widths: widths,
sizes: sizes,
urlBuilder: urlBuilder,
loading: loading,
decoding: decoding,
fetchPriority: fetchPriority,
priority: priority,
attrs: attrs,
),
on: _buildImageEvents(
onClick: onClick,
onLoad: onLoad,
onError: onError,
fallbackSrc: fallbackSrc,
),
) {
if (ref != null) {
// If a ref is passed directly to the constructor, wrap via RefNode in higher composition
}
}