- override
The rectangle to use for the highlight effect and for clipping
the splash effects if containedInkWell
is true.
This method is intended to be overridden by descendants that
specialize InkResponse
for unusual cases. For example,
TableRowInkWell
implements this method to return the rectangle
corresponding to the row that the widget is in.
The default behavior returns null, which is equivalent to returning the referenceBox argument's bounding box (though slightly more efficient).
Source
@override RectCallback getRectCallback(RenderBox referenceBox) { return () { RenderObject cell = referenceBox; AbstractNode table = cell.parent; Matrix4 transform = new Matrix4.identity(); while (table is RenderObject && table is! RenderTable) { RenderTable parentBox = table; parentBox.applyPaintTransform(cell, transform); assert(table == cell.parent); cell = table; table = table.parent; } if (table is RenderTable) { TableCellParentData cellParentData = cell.parentData; assert(cellParentData.y != null); Rect rect = table.getRowBox(cellParentData.y); // The rect is in the table's coordinate space. We need to change it to the // TableRowInkWell's coordinate space. table.applyPaintTransform(cell, transform); Offset offset = MatrixUtils.getAsTranslation(transform); if (offset != null) return rect.shift(-offset); } return Rect.zero; }; }