Canvas constructor

Canvas({
  1. CanvasController? controller,
  2. int width = 300,
  3. int height = 150,
  4. String? className,
  5. Map<String, Object?> props = const {},
  6. Map<String, Object?> style = const {},
  7. DartStyle? dartStyle,
})

Creates a canvas element.

Implementation

Canvas({
  this.controller,
  int width = 300,
  int height = 150,
  String? className,
  Map<String, Object?> props = const {},
  Map<String, Object?> style = const {},
  DartStyle? dartStyle,
}) : super(
       'canvas',
       props: mergeComponentProps(
         {
           ...props,
           if (controller != null) '_flintCanvasController': controller,
           'width': width,
           'height': height,
           'tabIndex': props['tabIndex'] ?? 0,
         },
         className: className,
         defaultStyle: const {
           'display': 'block',
           'max-width': '100%',
           'touch-action': 'none',
         },
         dartStyle: dartStyle,
         style: style,
       ),
     );