dnfield / flutter_svg

SVG parsing, rendering, and widget library for Flutter
MIT License
1.67k stars 459 forks source link

Using SVG in TabBar tab icons #1005

Open ced1check opened 1 year ago

ced1check commented 1 year ago

I'm trying to use SvgPicture.asset() inside a TabBar tabs.

Unfortunately the labelColor and unselectedLabelColor are not used to draw the icons as it does when using Simple Icons or FavIcons.

Any way to transform the SvgPicture into a true icon?

Secondly, there results appears blury for some reason!?

Found some references, but no solution:

https://github.com/flutter/flutter/issues/123291 (closed and redirect to stackoverflow) https://stackoverflow.com/questions/72191667/how-to-use-svg-in-tabsicon

ced1check commented 1 year ago

Ended-up using https://pub.dev/packages/path_icon

Creating a "standard" icon is quite simple: PathIcon( PathIconData.fromSvg(svg) )

It'll be tinted appropriately by TabBar and probably any other UI widget.