pushOffset method Null safety
- Offset offset
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:
- pushTransform, which is similar to pushOffset but allows general transform besides translation.
- BoxHitTestResult.addWithPaintOffset, which is a public wrapper around this function for hit testing on RenderBoxs.
- SliverHitTestResult.addWithAxisOffset, which is a public wrapper around this function for hit testing on RenderSlivers.
Implementation
@protected
void pushOffset(Offset offset) {
assert(offset != null);
_localTransforms.add(_OffsetTransformPart(offset));
}