img function
ElementNode
img(
{ - Object? key,
- required String src,
- String? alt,
- int? width,
- int? height,
- bool lazy = false,
- String? classes,
- Map<String, String>? style,
- Map<String, Attribute>? attrs,
})
Implementation
ElementNode img({
Object? key,
required String src,
String? alt,
int? width,
int? height,
bool lazy = false,
String? classes,
Map<String, String>? style,
Map<String, Attribute>? attrs,
}) {
return el(
'img',
key: key,
classes: classes,
style: style,
attrs: {
'src': StringAttribute(src),
if (alt != null) 'alt': StringAttribute(alt),
if (width != null) 'width': StringAttribute(width.toString()),
if (height != null) 'height': StringAttribute(height.toString()),
if (lazy) 'loading': StringAttribute('lazy'),
...?attrs,
},
children: const [],
);
}