You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey there,
I had been using another library before that had some nice helper functions, as seen below:
IconDatagetIconUsingPrefix({String name}) {
finalList<String> split = name.split('.');
if (split.length >1) {
name = split[1];
if (split[0].toLowerCase() =='fa'|| split[0].toLowerCase() =='fontawesome') {
returngetFontAwesomeIcon(name: name);
}
} else {
returngetIconGuessFavorMaterial(name: name);
}
returngetMaterialIcon(name: name);
}
// Returns an icon named in name favoring Font AwesomeIconDatagetIconGuessFavorFA({String name}) {
if (FontAwesomeIconsMap[name] !=null) {
returnFontAwesomeIconsMap[name];
} else {
returnIconsMap[name];
}
}
// Returns an icon named in name favoring MaterialIconDatagetIconGuessFavorMaterial({String name}) {
if (IconsMap[name] !=null) {
returnIconsMap[name];
} else {
returnFontAwesomeIconsMap[name];
}
}
It would let me retrieve an icon based on a string, which was perfect as all of my data is built from retrieving json data from my site. I have been looking for a larger variety of icons, so this package looked great, but I am having issue trying to get them as I have been prior.
I tried to see if I could use something like this:
I don't recommend getting the icon this way. I recommend using the static property of the class, such asAntDesign.stepforward,
This has the following advantages:
1. You can get friendly hints from editors, such as Android studio
2. If you can get the static property, the icon must exist
3. You can get icons of type const
If you use a string to get the icon, you won't get any of these advantages
But, what about the case where one is getting an icon from the backend. Backend is ensuring to send the icons which actually exist. In that case, it will be beneficial to map the icons with string.
Something like FlutterIcon.getIconData('<name-of-icon>')
Hey there,
I had been using another library before that had some nice helper functions, as seen below:
It would let me retrieve an icon based on a string, which was perfect as all of my data is built from retrieving json data from my site. I have been looking for a larger variety of icons, so this package looked great, but I am having issue trying to get them as I have been prior.
I tried to see if I could use something like this:
Is there anything available that I just didn't see, or that can be added to this package similar to this?
Thanks,
-MH
The text was updated successfully, but these errors were encountered: