Convert Image to IconData flutter

Viewed 8356

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.

1 Answers

You can easily use svg as IconData using FlutterIcon (Custom Icon Generator). Follow these steps :

  1. Go to FlutterIcon.com

  2. Drag and drop all your Icons

  3. Give a class name (Let's say CustomIcons)

  4. Download and Unzip.

  5. 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).

  6. Copy custom class CustomIcons that we generated to your lib directory.

  7. Use CustomIcons as IconData :

    Icon(CustomIcons.hamburger)

Related