addLineWidget method

LineWidget addLineWidget(
  1. dynamic line,
  2. Element node, {
  3. bool? coverGutter,
  4. bool? noHScroll,
  5. bool? above,
  6. bool? handleMouseEvents,
  7. int? insertAt,
  8. String? className,
})

Adds a line widget, an element shown below a line, spanning the whole of the editor's width, and moving the lines below it downwards. line should be either an integer or a LineHandle, and node should be a DOM node, which will be displayed below the given line.

coverGutter: whether the widget should cover the gutter. noHScroll: whether the widget should stay fixed in the face of horizontal scrolling. above: causes the widget to be placed above instead of below the text of the line. handleMouseEvents: determines whether the editor will capture mouse and drag events occurring in this widget. Default is false — the events will be left alone for the default browser handler, or specific handlers on the widget, to capture. insertAt: by default, the widget is added below other widgets for the line. This option can be used to place it at a different position (zero for the top, N to put it after the Nth other widget). Note that this only has effect once, when the widget is created. className: Add an extra CSS class name to the wrapper element created for the widget.

Implementation

LineWidget addLineWidget(dynamic line, Element node,
    {bool? coverGutter,
    bool? noHScroll,
    bool? above,
    bool? handleMouseEvents,
    int? insertAt,
    String? className}) {
  var options = {};

  if (coverGutter != null) options['coverGutter'] = coverGutter;
  if (noHScroll != null) options['noHScroll'] = noHScroll;
  if (above != null) options['above'] = above;
  if (handleMouseEvents != null) {
    options['handleMouseEvents'] = handleMouseEvents;
  }
  if (insertAt != null) options['insertAt'] = insertAt;
  if (className != null) options['className'] = className;

  var l = line is LineHandle ? line.jsProxy : line;
  return LineWidget(callArgs('addLineWidget', [l, node, jsify(options)]));
}