applyPaintTransform method Null safety

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

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.

Implementation

@override
void applyPaintTransform(RenderBox child, Matrix4 transform) {
  final SliverMultiBoxAdaptorParentData childParentData = child.parentData! as SliverMultiBoxAdaptorParentData;
  if (childParentData.index == null) {
    // If the child has no index, such as with the prototype of a
    // SliverPrototypeExtentList, then it is not visible, so we give it a
    // zero transform to prevent it from painting.
    transform.setZero();
  } else if (_keepAliveBucket.containsKey(childParentData.index)) {
    // It is possible that widgets under kept alive children want to paint
    // themselves. For example, the Material widget tries to paint all
    // InkFeatures under its subtree as long as they are not disposed. In
    // such case, we give it a zero transform to prevent them from painting.
    transform.setZero();
  } else {
    applyPaintTransformForBoxChild(child, transform);
  }
}