path_icon은 사용자 정의 벡터 경로에서 생성된 아이콘 위젯을 제공하는 Flutter 패키지입니다. 정확한 경로 정의를 사용하여 확장 가능하고 해상도에 의존하지 않는 아이콘을 만들 수 있으며, 기존 이미지 기반 접근 방식보다 아이콘 디자인에 대한 더 큰 제어력을 제공합니다. 고유하거나 스타일화된 아이콘을 필요로 하는 앱에 적합하며, 모바일, 웹, 데스크톱을 포함한 모든 주요 플랫폼을 지원합니다. 패키지는 Flutter의 렌더링 파이프라인과 원활하게 통합되며 색상, 크기, 선 속성 등을 쉽게 사용자 지정할 수 있습니다.
If you don't give a viewBox, it is deduced from the path's bounds.
From SVG
To initialize the path with a data string as defined in SVG paths, use the fromData constructor.
Warning : the supported operations are very limited, on purpose. This makes the parsing pass more efficient ! So make sure to optimize your content before using it. Learn how to optimize your exports.
The built-in Icon widget uses font characters to renders icons. Since it may be more optimized, so more recommended in most cases, PathIcon may be better for development loop (i.e. exporting path data from a software like Figma) and it provides a simple animated variant.
What is the difference with flutter_svg images ?
SVG images are a lot more complete : they support colors, clipping and various other effects. So if you want to display complex icons, they may be a better option. But this comes at a cost : the parsing may be less efficient, and animated colors are not included. PathIcon on its side merges all paths from the document as a single Path to achieve this.
Why is the parsing of my SVG file isn't working well ?
The parsing pass is extremely simple, on purpose. You may have to cleanup a bit your SVG before importing it by having only simple filled (make sure to outline strokes and flatten your icon before exporting from your design software) elements : rect, ellipse, path, circle. The g groups have a basic support with only transforms. A more complete parsing solution may arrive in a near future, but it will have a dedicated parameter to make you realize the additional overrhead implied.