BirjuVachhani / spider

A small dart library to generate Assets dart code from assets folder.
https://spider.birju.dev/
Apache License 2.0
190 stars 20 forks source link

[Feature] Create master class with all the other one as field #18

Closed bounty1342 closed 4 years ago

bounty1342 commented 4 years ago

Hey,

I think it would be easier to always import the same base class, with all the generated class as field> Then we can use Class.subclass.img to retrieve the image.

It would be even better, if this could match the directory :

Then we can access Assets.images.login.bar.icon pretty easily.

  1. Only one import to figure out
  2. Easier to find the right image, without looking at the assets folder

Let me know what you thinks about it. Regards

BirjuVachhani commented 4 years ago

@bounty1342 How do you propose to achieve this: Assets.images.login.bar.icon?

bounty1342 commented 4 years ago

@BirjuVachhani : this is a very naive solution, Link

This could surely be perfected.

BirjuVachhani commented 4 years ago

@bounty1342 This makes sense but don't you think managing assets by screens or modules will complicate things like:

  1. reusability - Although it can be reused easily, the path it represents tells a different story.
  2. You have list all the folders in pubspec.yaml
bounty1342 commented 4 years ago

Don't want to speak about everybody but my asset folder is already organized like this : image

I presume one alternative could also be : Assets.images_login_bar_icon

If you want a file to be used by several view, you place it in the cross path (directory wise), or at the root...

BirjuVachhani commented 4 years ago

Closing this as I'm having no plans for this in near future.