jb3rndt / PersistentBottomNavBarV2

A highly customizable persistent bottom navigation bar for Flutter
https://pub.dev/packages/persistent_bottom_nav_bar_v2
BSD 3-Clause "New" or "Revised" License
47 stars 48 forks source link

SVG image instead of Icon #126

Closed ctujare closed 4 months ago

ctujare commented 5 months ago

Current Output when SVG image is used instead of an Icon

Screenshot 2024-02-12 155116

Is there a way I can use the SVG image instead of the icon

Currently the plus is an icon using Icon() and the other 3 are SvgPicture.asset()

lcardozoaplauze commented 4 months ago

Try this:

PersistentBottomNavBarItem(
  icon: Container(
    alignment: Alignment.center,
    child: SvgPicture.asset(
      "icon.svg",
      width: 20,
      height: 20,
      colorFilter: ColorFilter.mode(
        Colors.red,
        BlendMode.srcIn,
      )
    )
  ),
  inactiveIcon: Container(
    alignment: Alignment.center,
    child: SvgPicture.asset(
      "icon.svg",
      width: 20,
      height: 20,
      colorFilter: ColorFilter.mode(
        Colors.blueGrey,
        BlendMode.srcIn,
      )
    )
  ),
  // ...
);
jb3rndt commented 4 months ago

Thank you for reporting this issue. From what I can seee you are using version 5 of the package with the prebuilt style 1? I found the error and it will be fixed with the next version of the beta. Thanks @lcardozoaplauze for posting a fix.

jb3rndt commented 4 months ago

Resolved with version 5.0.0-beta.9

ctujare commented 4 months ago

This is perfect ... Thank you sooo much

ctujare commented 4 months ago

Try this:

PersistentBottomNavBarItem(
  icon: Container(
    alignment: Alignment.center,
    child: SvgPicture.asset(
      "icon.svg",
      width: 20,
      height: 20,
      colorFilter: ColorFilter.mode(
        Colors.red,
        BlendMode.srcIn,
      )
    )
  ),
  inactiveIcon: Container(
    alignment: Alignment.center,
    child: SvgPicture.asset(
      "icon.svg",
      width: 20,
      height: 20,
      colorFilter: ColorFilter.mode(
        Colors.blueGrey,
        BlendMode.srcIn,
      )
    )
  ),
  // ...
);

This worked like a charm ... Thank you