Icon constructor
Icon(})
Creates an inline SVG icon from a IconData definition.
Implementation
Icon(
IconData icon, {
Object? size = 20,
Object? color,
double strokeWidth = 2,
String? label,
String? title,
bool? decorative,
String? className,
Map<String, Object?> props = const {},
Map<String, Object?> style = const {},
}) : super(
'svg',
props: mergeComponentProps(
{
...props,
'xmlns': 'http://www.w3.org/2000/svg',
'viewBox': icon.viewBox,
'fill': 'none',
'stroke': 'currentColor',
'stroke-width': strokeWidth,
'stroke-linecap': 'round',
'stroke-linejoin': 'round',
'focusable': 'false',
if (decorative ?? (label == null && title == null))
'aria-hidden': 'true'
else ...{
'role': 'img',
'aria-label': label ?? title ?? icon.name,
},
},
className: className,
defaultStyle: {
'display': 'inline-block',
'width': _iconCssSize(size),
'height': _iconCssSize(size),
'color': color ?? 'currentColor',
'vertical-align': 'middle',
'flex-shrink': 0,
},
style: style,
),
children: [
if (title != null)
FlintElement('title', children: [FlintText(title)]),
...icon.shapes.map((shape) => shape.toNode()),
],
);