Closed rs5173 closed 3 years ago
As the number of SvgPicture increases, frame drop will become very serious
After deleting SvgPicture, it becomes smooth
What if you add repaint boundaries around the SVG?
It also really depends on what the SVG is. :)
I don’t quite understand what "add repaint boundaries around the SVG" means. I tried to set allowDrawingOutsideViewBox to true, but it still has no effect.
The SVGs I use are all small icons, such as
`
`
All svg comes from adobe xd
So instead of something like ListView(children: [SvgPicture.asset(...), SvgPicture.asset(...)]
, do ListView(children: [RepaintBoundary(child: SvgPicture.asset(...)), RepaintBoundary(child: SvgPicture.asset(...))]
.
Using RepaintBoundary did not help me much. In the end, I found a package called flutter_svg_provider. Its method is to convert SVG data into an Image at runtime. This issue was resolved.
thank you for your reply!
I am having the exact same issue especially on web canvaskit
I have several svg's on my GridView
items and while scrolling the GridView
the performance is very low. Once I remove the svg tags the performance is normal
I tried RepaintBoundary
but it did not change much + it requires lots of extra memory because flutter engine creates a new sperate tree for each RepaintBoundary
.
Any updates on this? In my app it used to be ok when I used flutter_svg: 0.23.0+1 version but after upgrading to latest version I also started experiencing huge problems with performance of svg items in scrollable lists
@olegyablokov please share a reproduction.
Using RepaintBoundary did not help me much. In the end, I found a package called flutter_svg_provider. Its method is to convert SVG data into an Image at runtime. This issue was resolved.
I also solved like that. Thanks
After repeated investigation, it is finally found that flutter_svg will cause severe frame drop in scrollable widgets, flutter version is 2.2