visitParentNode method

  1. @override
Node visitParentNode(
  1. ParentNode parentNode,
  2. AffineMatrix data
)

Visit a ParentNode.

Implementation

@override
Node visitParentNode(ParentNode parentNode, AffineMatrix data) {
  final AffineMatrix nextTransform = parentNode.concatTransform(data);

  final Paint? saveLayerPaint = parentNode.createLayerPaint();

  final Node result;
  if (saveLayerPaint == null) {
    result = ParentNode(
      SvgAttributes.empty,
      precalculatedTransform: AffineMatrix.identity,
      children: <Node>[
        for (Node child in parentNode.children)
          child
              .applyAttributes(parentNode.attributes)
              .accept(this, nextTransform),
      ],
    );
  } else {
    result = SaveLayerNode(
      SvgAttributes.empty,
      paint: saveLayerPaint,
      children: <Node>[
        for (Node child in parentNode.children)
          child
              .applyAttributes(parentNode.attributes.forSaveLayer())
              .accept(this, nextTransform),
      ],
    );
  }
  return result;
}