parseDefs method

void parseDefs(
  1. Rect rect
)

Implementation

void parseDefs(Rect rect) {
  var element = renderStyle.target as SVGElement;
  dynamic fillAttr = element.attributeStyle['fill'] ?? findRoot()?.element.attributeStyle['fill'];
  dynamic clipPathAttr = element.attributeStyle['clipPath'] ?? findRoot()?.element.attributeStyle['clipPath'];
  if (fillAttr == null && clipPathAttr == null) return;

  NodeList? nodeList = element.findRoot()?.childNodes;
  if (nodeList != null) {
    Iterator iterator = nodeList.iterator;
    while (iterator.moveNext()) {
      if (iterator.current is SVGDefsElement) {
        SVGDefsElement element = iterator.current ;
        if (fillAttr != null && _shader == null) {
          _shader = element.getShader(fillAttr, rect);
        }
        if (clipPathAttr != null && _svgClipPath == null) {
          _svgClipPath = element.getClipPath(clipPathAttr, rect);
        }
      }
    }
  }
}