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
Icon names are retrieved from server.
So a method for getting IconData from icon name is needed.
Icons.fromName(iconName)
iconName is the same as the constant name in Icons class.
pub.dev package material_icon_design_flutter does not contain many of the IconData constants defined in Icons, so it is not designed to provide name mappings for the Icons class.
Proposal
Add a new method for mapping names to IconData constants:
IconData Icons.fromName(iconName)
IconName are those already defined as constants such as more_vert.
IconData fromName(String iconName) {
if (iconName=='more_vert') return Icons.more_vert;
....
}
or build a map from names to IconData constants.
The text was updated successfully, but these errors were encountered:
Hi. Interesting use case. Here is a possible solution.
Icon(Icons.more_vert);
If we look at the Icon constructor invoked above in the source code, we will see that the Icon class accepts an argument of type IconData and so Icons.more_vert is actually of type IconData.
@javaone199
I'll reopen the original issue. Just make sure you respond to the question asked by the team member in that issue. #145302 (comment)
Closing this issue.
Use case
Could not reopen the issue #145302.
Icon names are retrieved from server.
So a method for getting IconData from icon name is needed.
Icons.fromName(iconName)
iconName is the same as the constant name in Icons class.
pub.dev package material_icon_design_flutter does not contain many of the IconData constants defined in Icons, so it is not designed to provide name mappings for the Icons class.
Proposal
Add a new method for mapping names to IconData constants:
IconData Icons.fromName(iconName)
IconName are those already defined as constants such as more_vert.
or build a map from names to IconData constants.
The text was updated successfully, but these errors were encountered: