pushOffset method Null safety

  1. @protected
void pushOffset(
  1. Offset offset
)
protected">@protected

Pushes a new translation offset that is to be applied to all future HitTestEntrys added via add until it is removed via popTransform.

This method is only to be used by subclasses, which must provide coordinate space specific public wrappers around this function for their users (see BoxHitTestResult.addWithPaintOffset for such an example).

The provided offset should describe how to transform PointerEvents from the coordinate space of the method caller to the coordinate space of its children. Usually offset is the inverse of the offset of the child relative to the parent.

HitTestables need to call this method indirectly through a convenience method defined on a subclass before hit testing a child that does not have the same origin as the parent. After hit testing the child, popTransform has to be called to remove the child-specific transform.

See also:

Implementation

@protected
void pushOffset(Offset offset) {
  assert(offset != null);
  _localTransforms.add(_OffsetTransformPart(offset));
}