MouseEvent构造函数

MouseEvent(
  1. String type,
  2. {Window? view,
  3. int detail = 0,
  4. int screenX = 0,
  5. int screenY = 0,
  6. int clientX = 0,
  7. int clientY = 0,
  8. int button = 0,
  9. bool canBubble = true,
  10. bool cancelable = true,
  11. bool ctrlKey = false,
  12. bool altKey = false,
  13. bool shiftKey = false,
  14. bool metaKey = false,
  15. EventTarget? relatedTarget}
)

实现

factory MouseEvent(String type,
    {Window? view,
    int detail = 0,
    int screenX = 0,
    int screenY = 0,
    int clientX = 0,
    int clientY = 0,
    int button = 0,
    bool canBubble = true,
    bool cancelable = true,
    bool ctrlKey = false,
    bool altKey = false,
    bool shiftKey = false,
    bool metaKey = false,
    EventTarget? relatedTarget}) {
  if (view == null) {
    view = window;
  }
  MouseEvent event = document._createEvent('MouseEvent') as MouseEvent;
  event._initMouseEvent(
      type,
      canBubble,
      cancelable,
      view,
      detail,
      screenX,
      screenY,
      clientX,
      clientY,
      ctrlKey,
      altKey,
      shiftKey,
      metaKey,
      button,
      relatedTarget);
  return event;
}