Reputation: 1116
I know there is a way to convert image to Icon
via ImageIcon
. But I'm using FancyBottomNavigation
which is required TabData
that has parameter iconData
type IconData
. Is there anyway to convert image to IconData.
Upvotes: 15
Views: 18600
Reputation: 7983
You can easily use svg
as IconData using FlutterIcon (Custom Icon Generator). Follow these steps :
Go to FlutterIcon.com
Drag and drop all your Icons
Give a class name (Let's say CustomIcons
)
Download and Unzip.
Copy fonts
folder to your app folder and add the fonts
as you add a normal font in flutter. (See here how to add a custom font).
Copy custom class CustomIcons
that we generated to your lib
directory.
Use CustomIcons
as IconData
:
Icon(CustomIcons.hamburger)
Upvotes: 33