Phuoc
Phuoc

Reputation: 1116

Convert Image to IconData flutter

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

Answers (1)

Shubhamhackz
Shubhamhackz

Reputation: 7983

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)

Upvotes: 33

Related Questions