AppCheap / awesome_bottom_bar

BSD 3-Clause "New" or "Revised" License
46 stars 34 forks source link

[Bug] Fixed a bug when passing icon as a widget to TabItem #15

Open issaloubani opened 9 months ago

issaloubani commented 9 months ago

Adding a widget as an icon to TabItem as follows (any type of widget will suffice):

TabItem<Widget>(icon: SvgPicture.asset(Assets.iconsConversation), title: "Home"),

will cause an exception even when specifying the icon type to Widget and not IconData. The bug is caused by the they following line in build_icon.dart :

Widget icon = Icon(
      item.icon,
      size: iconSize,
      color: iconColor,
    );

since the item.icon type will be considered an IconData even if specified as widget, this is fixed by adding the following check:

Widget icon = (item.icon is Widget) ? item.icon : Icon(
      item.icon,
      size: iconSize,
      color: iconColor,
    );
a-wallen commented 9 months ago

@issaloubani I was just about to fix this. Thanks! I'll be cloning your fork locally 🤣

issaloubani commented 9 months ago

@a-wallen Don't mention it 👍 . Happy to help.

TrueJu commented 6 months ago

When will this be merged with master?