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
49 stars 54 forks source link

context in onPressed always null. #123

Closed TOMSLAUS closed 6 months ago

TOMSLAUS commented 9 months ago

When` callin onPressed in PersistentBottonNavBarItem context is always null.

Here is how the navBarItem looks.

PersistentBottomNavBarItem(
  icon: const FaIcon(FontAwesomeIcons.house),
  title: (t.misc.home),
  activeColorPrimary: CupertinoColors.white,
  inactiveColorPrimary: CupertinoColors.white,
  onPressed: (context){
    print(context.toString());
    if(context != null) {
    Nav.popUntil(context: context, namedRoute: TeamDashBoardPage.routeName); 
    }
  }
),

Sorry, for some reason code isn't formatting how its supposed to.

jb3rndt commented 8 months ago

Hi, I'll need a while to figure that out. Please check out the current beta version of this package (https://pub.dev/packages/persistent_bottom_nav_bar_v2/versions/5.0.0-beta.7). There is a good chance you wont have that issue there. If you have trouble migrating to the new version check out this guide: https://github.com/jb3rndt/PersistentBottomNavBarV2/blob/rework_interface/MigrationGuide.md

jb3rndt commented 6 months ago

Should be fixed with Version 5 :)