svg_bin 0.2.1
svg_bin: ^0.2.1 copied to clipboard
A flutter pacakge that compiles your svg to vec and helps display vec
SVG_BIN #
A helper flutter pacakge that converts your .svg files to binary with the extension .vec using vector_graphics_compiler and provides a widget to render those .vec files using vector_graphics package.
Note: Under Construction #
Features #
- ✅ generate .vec files
- ✅ generate asset class
- ✅ folder asset class
- ✅ category class
- ❌
add args parser to toggle category modes - ✅ add args parser to change assets directory (input) and assets class directory(output)
- ❌ seperate converting files and creating the dart file.
- ❌ seperate the bin folders out of the asset folder
Getting started #
- Install the package using following command inside your flutter project.
flutter pub add svg_bin
- Generate the vec files using the following command
dart run svg_bin
- The
AppAssetclass is generated inside/lib/src/core/app_assets/assets.dart(adding custom path is on the agenda) - Render the .vec with the
SvgBin()widget
Usage #
Currently this supports only one input direcotry which will be /assets in your flutter root.
- Rename your assets to be in the following format:
assets/subfolder/category_name-asset_name.svg
- This will generate the main asset class, the sub folder class and the category name class, with String getters that will have the actual path of the asset.
- Make sure you have imported the bin folders into the
pubspec.ymlof your flutter project. (Don't want to mess with yml just yet). - Then just do
dart run svg_binat root of your flutter project. - To use the
.vecassets use theSvgBin()widget - For the love of god don't make your category or folder name same as some of the inbuilt classes in Dart and Flutter.
for a asset like
assets/icons/finance-money.svg
after running the command
SvgBin(
AppAsset.icons.finance.money,
)
Additional information #
Very special thanks to Avishek Subedi dai.