Closed SerggioC closed 3 years ago
Hi @SerggioC! Thanks for using FlutterGen.
Question: How does flutter gen handle images for different resolutions? This could be done automatically.
Actually, this was done automatically. If you arrange the file structure properly then those resolution-aware images will be handled properly by the flutter framework. You can check this post: https://medium.com/@nileshsenta1991/flutter-resolution-aware-image-assets-234c82216cef.
For example:
Resolution-aware image
.../brand_logo.png
.../2.0x/brand_logo.png
.../3.0x/brand_logo.png
Pubspec
flutter:
assets:
- assets/brand_logo.png
Use FlutterGen
Image(
image: Assets.brandLogo.image(),
)
Hi @lcdsmao So I was defining this folders in pubspec.yaml, that is the error.
assets:
- assets/images/1x/
- assets/images/2x/
- assets/images/3x/
So we just need to put the images in the correct density folders (2.0x, 3.0x) and set pubspec:
assets:
- assets/images/
And the image is loaded with the correct density.
image: Assets.brandLogo.image(),
Thanks for the help!
Create the folders for:
Code for the assets in this folders are not generated.
Question: How does flutter gen handle images for different resolutions? This could be done automatically.