Dropzone constructor

Dropzone(
  1. dynamic elementOrElementList, {
  2. Acceptor? acceptor,
  3. String overClass = 'dnd-over',
  4. String invalidClass = 'dnd-invalid',
})

Creates a Dropzone for elementOrElementList. The elementOrElementList must be of type Element or ElementList.

Options

The acceptor is used to determine which Draggables will be accepted by this Dropzone. If none is specified, all Draggables will be accepted.

The overClass is the css class set to the dropzone element when an accepted Draggable is dragged over it. If set to null, no such css class is added.

The invalidClass is the css class set to the dropzone element when an not-accepted Draggable is dragged over it. If set to null, no such css class is added.

Implementation

Dropzone(elementOrElementList,
    {this.acceptor,
    this.overClass = 'dnd-over',
    this.invalidClass = 'dnd-invalid'}) {
  // Wrap in a List if it is not a list but a single Element.
  _elements = elementOrElementList is List<Element>
      ? elementOrElementList
      : [elementOrElementList];

  // Install drag listeners on Elements.
  _elements.forEach(_installCustomDragListener);
}