flutter_svg icon indicating copy to clipboard operation
flutter_svg copied to clipboard

Add Support for vector-effects

Open Rossdex opened this issue 4 years ago • 1 comments

I have an app that requires viewing large scale svg's in high detail.

Below I have an example SVG that has non-scaling-stroke attribute on one of the boxes, if I display this using SVGPicture.asset when I increase the size of the SVG by putting it into an overflow box the scaling is wrong. Is there a way we can get the package to listen to vector-effect="non-scaling-stroke" ?

Any help/ Advise would be much appreciated.

<svg viewBox="0 0 90 45" xmlns="http://www.w3.org/2000/svg"> <rect x="1" y="1" width="40" height="40" fill="white" stroke="blue" stroke-width="1px" vector-effect="non-scaling-stroke"/> <rect x="45" y="1" width="40" height="40" fill="white" stroke="green" stroke-width="1px" /> </svg>

Example Code

Container( clipBehavior: Clip.none, child: new OverflowBox( minWidth: 0.0, minHeight: 0.0, maxWidth: double.infinity, child: SvgPicture.asset( 'assets/example.svg', fit: BoxFit.cover, width: 800 * 30, height: 600 * 30, ), ), )

Rossdex avatar Jun 18 '21 09:06 Rossdex

I have mixed feelings about implementing anything from the SVG 2 spec - its browser support is really limited and I'm worried about it causing more confusion than help.

I'm also not quite sure what would be necessary to support this attribute.

That said, I'd be happy to review aPR that attempts it.

dnfield avatar Jun 18 '21 16:06 dnfield