BloomImage constructor

BloomImage({
  1. required String src,
  2. String? alt,
  3. bool decorative = false,
  4. int? width,
  5. int? height,
  6. String? aspectRatio,
  7. List<int>? widths,
  8. String? sizes,
  9. ImageUrlBuilder? urlBuilder,
  10. ImageLoading loading = ImageLoading.lazy,
  11. ImageDecoding decoding = ImageDecoding.async,
  12. FetchPriority? fetchPriority,
  13. bool priority = false,
  14. String? placeholder,
  15. String? fallbackSrc,
  16. ImageFit? fit,
  17. String? className,
  18. String? style,
  19. Map<String, String>? attrs,
  20. BloomEventHandler? onClick,
  21. BloomEventHandler? onLoad,
  22. BloomEventHandler? onError,
  23. 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
  }
}