dragEnd method
Called when the drag operation ends.
The avatar must be removed from the DOM in this method if it is not needed any more.
The startPosition
is the position where the drag started, position
is the
current position. Both are relative to the whole document (page coordinates).
Implementation
@override
void dragEnd(Point startPosition, Point position) {
// Remove the translate and set the new position as left/top.
removeTranslate();
// Set the new position as left/top. Prevent from moving past the top and
// left borders as the user might not be able to grab the element any more.
Point constrainedPosition =
Point(math.max(1, position.x), math.max(1, position.y));
setLeftTop(constrainedPosition - startPosition + _draggableStartOffset!);
}