Canvas function

Component Canvas({
  1. int? width,
  2. int? height,
  3. String? className,
  4. String? style,
  5. String? id,
  6. Component? child,
  7. List<Component>? children,
  8. Map<String, String>? attributes,
  9. Map<String, EventCallback>? events,
  10. Key? key,
})

A canvas element.

The HTML <canvas> element is used to draw 2D/3D graphics via the Canvas API or WebGL.

Implementation

Component Canvas({
  int? width,
  int? height,
  String? className,
  String? style,
  String? id,
  Component? child,
  List<Component>? children,
  Map<String, String>? attributes,
  Map<String, EventCallback>? events,
  Key? key,
}) {
  return Component.element(
    tag: 'canvas',
    id: id,
    classes: className,
    styles: parseStyles(style),
    attributes: {
      if (width != null) 'width': width.toString(),
      if (height != null) 'height': height.toString(),
      ...?attributes,
    },
    events: events,
    children: resolveChildren(child, children),
    key: key,
  );
}