GSVG.fromSVG constructor

GSVG.fromSVG(
  1. int x,
  2. int y,
  3. int width,
  4. int height,
  5. String svg, {
  6. PColor? strokeColor,
  7. int? strokeSize,
  8. PColor? fillColor,
  9. num? scaleX,
  10. num? scaleY,
})

Implementation

factory GSVG.fromSVG(int x, int y, int width, int height, String svg,
    {PColor? strokeColor,
    int? strokeSize,
    PColor? fillColor,
    num? scaleX,
    num? scaleY}) {
  var returnViewBox = <_SVGViewBox?>[null];

  var elements = _parseSVG(svg,
      strokeColor: strokeColor,
      strokeSize: strokeSize,
      fillColor: fillColor,
      returnViewBox: returnViewBox);

  var viewBox = returnViewBox[0];

  viewBox = viewBox?.copyWith(svgWidth: width, svgHeight: height);

  return GSVG(
      x,
      y,
      width,
      height,
      strokeColor: strokeColor,
      strokeSize: strokeSize,
      fillColor: fillColor,
      scaleX: scaleX ?? viewBox?.scaleX,
      scaleY: scaleY ?? viewBox?.scaleY,
      elements);
}