ziofat / material_design_icons_flutter

The Material Design Icons (https://materialdesignicons.com/) Icon pack available as set of Flutter Icons.
MIT License
167 stars 32 forks source link

It would be nice to get the icon by string for late binding #5

Closed ride4sun closed 5 years ago

ride4sun commented 5 years ago

Hello, thank you for this great package. I using late binding and would like to define Icons by there name like MdiIcons('sword'). That would allow me to define the icons in the domain without the reference of the package and I could create the UI dynamically in run-time.

ziofat commented 5 years ago

That is a great idea, I will try this in days.

ride4sun commented 5 years ago

@ziofat thx thats really cool

ride4sun commented 5 years ago

@ziofat I was just wondering if you found the time to work on it. Is there something I can do?

ziofat commented 5 years ago

@ride4sun Hi, I have published a new version of this package. Check readme to see is that satisfied you.

ride4sun commented 5 years ago

@ziofat Thank u. I will try it in the next few day and let u know. Great work.

ride4sun commented 5 years ago

@ziofat I think a static method would look better like:

MDiIcons.fromString(bloc.iconName)

instead of

MdiIcons()[bloc.iconName])

everything else is static and MdiIcons()[bloc.iconName] would be the only place where you would create an instance. Otherwise awesome!

ziofat commented 5 years ago

I think you are right. I didn't put consideration in this.

miguelangel-nubla commented 5 years ago

Keep in mind that It is still useful to have a map that can be iterated to list or dynamically search icons by text.

In that regard, would it be possible to include the description and aliases as shown on the web page in a similar way? That would enable users to build icon pickers.

ziofat commented 5 years ago

@miguelangel-nubla I do know that aliases exist but they can not be used to access icon in material-design-icon. I can try to add alias support in example.

ride4sun commented 5 years ago

There could be another static which could returns the Iterator.

On Tue, Feb 19, 2019, 18:58 miguelangel-nubla notifications@github.com wrote:

Keep in mind that It is still useful to have a map that can be iterated to list or dynamically search icons by text.

In that regard, would it be possible to include the description and aliases as shown on the web page in a similar way? That would enable users to build icon pickers.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ziofat/material_design_icons_flutter/issues/5#issuecomment-465401094, or mute the thread https://github.com/notifications/unsubscribe-auth/AHYc62kPJpBXT8js8kAi6xrBmMFh-gCLks5vPLnqgaJpZM4aiZJK .

ziofat commented 5 years ago

closing this with 3.2.3595.