applyPaintTransform method

  1. @override
void applyPaintTransform(
  1. covariant RenderBox child,
  2. Matrix4 transform

Applies the transform that would be applied when painting the given child to the given matrix.

Used by coordinate conversion functions to translate coordinates local to one render object into coordinates local to another render object.

Some RenderObjects will provide a zeroed out matrix in this method, indicating that the child should not paint anything or respond to hit tests currently. A parent may supply a non-zero matrix even though it does not paint its child currently, for example if the parent is a RenderOffstage with offstage set to true. In both of these cases, the parent must return false from paintsChild.


void applyPaintTransform(RenderBox child, Matrix4 transform) {
  if (!paintsChild(child)) {
    // This can happen if some child asks for the global transform even though
    // they are not getting painted. In that case, the transform sets set to
    // zero since [applyPaintTransformForBoxChild] would end up throwing due
    // to the child not being configured correctly for applying a transform.
    // There's no assert here because asking for the paint transform is a
    // valid thing to do even if a child would not be painted, but there is no
    // meaningful non-zero matrix to use in this case.
  } else {
    applyPaintTransformForBoxChild(child, transform);