-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Suggestion] Automatically convert and create asset class #177
Comments
Neat. I haven't though enough about this yet to know if it's really the right path forward but it seems interesting. We've been talking with the flutter_tools team about having some kind of asset transformation available in the build process itself. /cc @jonahwilliams @andrewkolos FYI |
One big caveat is that we've intentionally avoided specing anything around generating source code. its really unclear what the path forward there would be, at least until we have more information on macros. I suspect that will only come after Dart 3. |
I understand, however this might still take some time as they are indeed working hard on Dart 3. I think I'll have another look and discuss with my colleagues if it's worth releasing a package like this (under my account). It makes it easier to adapt to vector_graphics as you can just add the SVG and a class is generated. But will be obsolete or converted when macro's become available or something similar. |
If you're interested in maintaining this package I'd be happy to mention it in the readme in this repo. I'd rather keep it separate for now. |
That would be perfect, I'll let you know if we decide something 😄 |
I'm going to check some stuff and make sure that it only generates bin files that it needs to generate etc. Optimise and add some tests. Then I'll publish it and let you know 👍 |
You can find the repo here: https://github.com/ikbendewilliam/vector_graphics_generator |
I would rather see a build tool that pulls SVG files from a folder and generates a discrete Icon component for each. The Icon component contains the compiled svg run through the codec and embedded in the icon class. I don't think the new asset transformation pipeline or macro support will enable this. Perhaps the Mason/Bricks library would with a pre-gen step to identify the relavant SVG files. The reason why this is important is to enable tree shaking for large icon libraries. If I use one icon from a package containing 1,000 icons, I don't want to pay the file size penalty for all icons. |
I've played around with the vector graphics and have a suggestion, a simple annotation where you can set all data to convert the svg's into vector files. I've made a working PoC (fork) that does the following:
This package provides a tool to generate vector graphics from svg files and creates a dart file with the vector graphics locations.
For example if you have the following structure:
And the following annotation:
The generator will create .vec files for each svg and create a dart file with the following content:
I'd love to hear some opinions. The upside is that it is easier to convert, there is automatically a class with all paths and it is updated quite easily. The downside is the use of build_runner, this might not be the best place and the converter command might already be sufficient. 🤔
The text was updated successfully, but these errors were encountered: