Img constructor

Img({
  1. required String src,
  2. String? alt,
  3. int? width,
  4. int? height,
  5. String? className,
  6. String? style,
  7. Map<String, String>? attrs,
  8. Map<String, BloomEventHandler>? on,
  9. BloomEventHandler? onClick,
})

Creates an <img> element descriptor with image attribute shorthands.

Implementation

Img({
  required String src,
  String? alt,
  int? width,
  int? height,
  super.className,
  super.style,
  Map<String, String>? attrs,
  Map<String, BloomEventHandler>? on,
  BloomEventHandler? onClick,
}) : super(
        'img',
        attrs: _mergeAttrs(attrs, {
          'src': src,
          if (alt != null) 'alt': alt,
          if (width != null) 'width': '$width',
          if (height != null) 'height': '$height',
        }),
        on: _mergeEvents(on, onClick: onClick),
      );