childDragAnchorStrategy function Null safety

Offset childDragAnchorStrategy(
  1. Draggable<Object> draggable,
  2. BuildContext context,
  3. Offset position
)

Display the feedback anchored at the position of the original child.

If feedback is identical to the child, then this means the feedback will exactly overlap the original child when the drag starts.

This is the default DragAnchorStrategy and replaces DragAnchor.child.

See also:

Implementation

Offset childDragAnchorStrategy(Draggable<Object> draggable, BuildContext context, Offset position) {
  final RenderBox renderObject = context.findRenderObject()! as RenderBox;
  return renderObject.globalToLocal(position);
}