Skip to content

[flutter_svg] Wrong render SVG (use symbol) #158686

Open
@stuartmorgan-g

Description

@stuartmorgan-g

Imported from dnfield/flutter_svg#657

Original report by @sytungan on Jan 24, 2022

Hi Dan,
I get some wrong renders in my app when I try to render an SVG:

SvgPicture.asset('images/test_svg.svg')

Output:
Screenshot_2
Expected:
Screenshot_1

The SVG source:

<svg width="240" height="240" fill="none"
    xmlns="http://www.w3.org/2000/svg"
    xmlns:xlink="http://www.w3.org/1999/xlink">
    <defs>
        <symbol id="svg_1" viewBox="0 0 105 105">
            <path d="M104.613 50.8914C105.019 51.8715 105.019 52.9728 104.613 53.9529L90.4677 88.1017C90.0618 89.0819 89.2831 89.8605 88.3029 90.2665L54.1541 104.411C53.174 104.817 52.0727 104.817 51.0926 104.411L16.9438 90.2665C15.9637 89.8605 15.185 89.0819 14.779 88.1017L0.634084 53.9529C0.228109 52.9728 0.228109 51.8715 0.634084 50.8914L14.779 16.7426C15.185 15.7625 15.9637 14.9838 16.9438 14.5778L51.0926 0.432876C52.0728 0.0269005 53.174 0.0269008 54.1541 0.432877L88.303 14.5778C89.2831 14.9838 90.0618 15.7625 90.4677 16.7426L104.613 50.8914Z" fill="#C4C4C4"/>
        </symbol>
    </defs>
    <rect x="120" y="120" width="60" height="60" fill="#C4C4C4" transform="rotate(51.82871827259324, 150.0,  150.0)"/>
    <g>
        <use x="100" y="50" width="60" height="60" xlink:href="#svg_1"/>
    </g>
</svg>

Version info:

  • flutter_svg 1.0.3
  • Flutter 2.8.1
  • Dart 2.15.1
  • On mobile devices (both Android and iOS)

Metadata

Metadata

Assignees

No one assigned

    Labels

    found in release: 3.32Found to occur in 3.32has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: flutter_svgThe Flutter SVG drawing packagespackageflutter/packages repository. See also p: labels.team-engineOwned by Engine team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions