hitTest method

  1. @override
bool hitTest(
  1. Size size,
  2. Offset position, {
  3. TextDirection? textDirection,
})
override

Tests whether the given point, on a rectangle of a given size, would be considered to hit the decoration or not. For example, if the decoration only draws a circle, this function might return true if the point was inside the circle and false otherwise.

The decoration may be sensitive to the TextDirection. The textDirection argument should therefore be provided. If it is known that the decoration is not affected by the text direction, then the argument may be omitted or set to null.

When a Decoration is painted in a Container or DecoratedBox (which is what Container uses), the textDirection parameter will be populated based on the ambient Directionality (by way of the RenderDecoratedBox renderer).

Implementation

@override
// TODO(ianh): better hit testing
bool hitTest(Size size, Offset position, { TextDirection? textDirection }) => true;