initializeElement method

void initializeElement()

Called when this Node is added to the tree or after the widget is updated.

Implementation

void initializeElement() {
  addEventSubscription(
    type: 'click',
    callback: widget.onTap,
    eventTransformer: (final html.Event event) => EventDetails(
      event,
      targetNode: this,
    ),
  );

  addEventSubscription(
    type: 'pointerdown',
    callback: widget.onPointerDown,
    eventTransformer: (final html.PointerEvent event) => PointerEventDetails(
      event,
      targetNode: this,
    ),
  );

  addEventSubscription(
    type: 'pointerup',
    callback: widget.onPointerUp,
    eventTransformer: (final html.PointerEvent event) => PointerEventDetails(
      event,
      targetNode: this,
    ),
  );

  addEventSubscription(
    type: 'pointerenter',
    callback: widget.onPointerEnter,
    eventTransformer: (final html.PointerEvent event) => PointerEventDetails(
      event,
      targetNode: this,
    ),
  );

  addEventSubscription(
    type: 'pointerleave',
    callback: widget.onPointerLeave,
    eventTransformer: (final html.PointerEvent event) => PointerEventDetails(
      event,
      targetNode: this,
    ),
  );

  addEventSubscription(
    type: 'pointermove',
    callback: widget.onPointerMove,
    eventTransformer: (final html.PointerEvent event) => PointerEventDetails(
      event,
      targetNode: this,
    ),
  );

  addEventSubscription(
    type: 'pointercancel',
    callback: widget.onPointerCancel,
    eventTransformer: (final html.PointerEvent event) => PointerEventDetails(
      event,
      targetNode: this,
    ),
  );

  addEventSubscription(
    type: 'pointerover',
    callback: widget.onPointerOver,
    eventTransformer: (final html.PointerEvent event) => PointerEventDetails(
      event,
      targetNode: this,
    ),
  );

  addEventSubscription(
    type: 'pointerout',
    callback: widget.onPointerOut,
    eventTransformer: (final html.PointerEvent event) => PointerEventDetails(
      event,
      targetNode: this,
    ),
  );

  if (widget.style == null) {
    element.removeAttribute('style');
  } else {
    element.setAttribute('style', widget.style!.toString());
  }
}