Giter VIP home page Giter VIP logo

jb3rndt / persistentbottomnavbarv2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bilalshahid13/persistentbottomnavbar

47.0 47.0 49.0 16.06 MB

A highly customizable persistent bottom navigation bar for Flutter

Home Page: https://pub.dev/packages/persistent_bottom_nav_bar_v2

License: BSD 3-Clause "New" or "Revised" License

Swift 0.69% Objective-C 0.02% Dart 80.16% Batchfile 0.31% Shell 0.32% Kotlin 0.05% CMake 7.72% C++ 9.44% C 0.57% HTML 0.73%

persistentbottomnavbarv2's People

Contributors

bilalshahid13 avatar bilalshahid96 avatar cchamm avatar danut007ro avatar emagnier avatar giampaologabba avatar h-unterp avatar holokobra avatar jb3rndt avatar lukehutch avatar madmini avatar mark8044 avatar marwenbk avatar napoleons avatar ne-ray avatar raywalz avatar rohithgilla12 avatar siloebb avatar xxjeevesxx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

persistentbottomnavbarv2's Issues

pushNamed not working

In the example, if I change the onPressed method in the MainScreen widget to use pushNamed, Navigator doesn't work.

onPressed: () {
  pushNewScreenWithRouteSettings(
    context,
    settings: RouteSettings(name: '/home'),
    screen: MainScreen2(),
    pageTransitionAnimation:
    PageTransitionAnimation.scaleRotate,
  );
},

to this

onPressed: () {
  Navigator.of(context).pushNamed('/first');
},

but this works

onPressed: () {
  Navigator.of(context).push(
    MaterialPageRoute(builder: (_) => MainScreen2())
  );
},

Am I doing something bad?
Why this is not working?

Thank you very much

How to navigate second tap's second screen from first tap's second screen

I navigate to second tab's second screen from the first tab's second screen as follows. It shows the screen but the first tab is still active. How can I make the second tab active?

pushNewScreenWithRouteSettings(
  context,
  settings: const RouteSettings(
      name: DownloadPlayListScreen.routeName),
  screen: DownloadPlayListScreen(
      favourite: state.favourite),
  pageTransitionAnimation:
      PageTransitionAnimation.scale,
);
PersistentBottomNavBarItem(
  icon: const Icon(Icons.home_outlined),
  title: "Home",
  activeColorPrimary:
      Theme.of(context).bottomNavigationBarTheme.selectedItemColor!,
  inactiveColorPrimary:
      Theme.of(context).bottomNavigationBarTheme.unselectedItemColor,
  inactiveColorSecondary: Theme.of(context).primaryColorLight,
  routeAndNavigatorSettings: RouteAndNavigatorSettings(
    initialRoute: '/',
    routes: {
      MonkScreen.routeName: (ctx) => const MonkScreen(),
      AlbumScreen.routeName: (ctx) => const AlbumScreen(),
      SongScreen.routeName: (ctx) => const SongScreen(),
      EbookScreen.routeName: (ctx) => const EbookScreen(),
      PdfScreen.routeName: (ctx) => const PdfScreen(),
      ChantingCatalogScreen.routeName: (ctx) =>
          const ChantingCatalogScreen(),
      ChantingScreen.routeName: (ctx) => const ChantingScreen(),
      ChantingDetailScreen.routeName: (ctx) =>
          const ChantingDetailScreen(),
      VideoScreen.routeName: (ctx) => const VideoScreen(),
      RadioScreen.routeName: (ctx) => const RadioScreen(),
      DownloadPlayListScreen.routeName: (ctx) =>
          const DownloadPlayListScreen(),
    },
  ),
),
PersistentBottomNavBarItem(
  icon: const Icon(Icons.create_new_folder_outlined),
  title: ("Library"),
  activeColorPrimary:
      Theme.of(context).bottomNavigationBarTheme.selectedItemColor!,
  inactiveColorPrimary:
      Theme.of(context).bottomNavigationBarTheme.unselectedItemColor,
  inactiveColorSecondary: Theme.of(context).primaryColorLight,
  routeAndNavigatorSettings: RouteAndNavigatorSettings(
    initialRoute: '/',
    routes: {
      FavouriteScreen.routeName: (ctx) => const FavouriteScreen(),
      FavouritePlayListScreen.routeName: (ctx) =>
          const FavouritePlayListScreen(),
      DownloadScreen.routeName: (ctx) => const DownloadScreen(),
      DownloadPlayListScreen.routeName: (ctx) =>
          const DownloadPlayListScreen(),
    },
  ),
),

Prevent tab change with the back key

Hello everybody,

I need help.
The back key works fine, but when I get to the "base" of the current tab, if I click the back key again it takes me back to the first tab, can I prevent this last behavior?

Many thanks in advance.

Best practice for Fade Transition

Hello and thank you for continuing this library!

This is my first time using this library and I need a fade transition when changing between main screens. (The default appears to be a slide transition?) Reading through the comments/posts from this and the previous version, it seems like the only way to change the transition is to use pushNewScreen() and specifying the transition? Is there a better way?

When I use pushNewScreen(), the nav bar is disappearing. I'm using the "example" code and adding the following code to the onPressed event in the PersistentBottomNavBarItem declaration:

onPressed: (_) { pushNewScreen(context, screen: HomeScreen(), withNavBar: true, pageTransitionAnimation: PageTransitionAnimation.fade); },

Thanks for your help!

btw - I tried using the context passed on on the onPressed event, but I get a null error on the context at runtime.

'TextStyle' is not a subtype of type 'Color?' in type cast

In the PersistentBottomNavBarItem class, the textStyle property expects the type TextStyle? but due to the use of as Color in the class implementation, we get this error. (NavBarStyle.style3)

Or am I doing something wrong?

      #0      BottomNavStyle3._buildItem (package:persistent_bottom_nav_bar_v2/nav-bar-styles/style-3-bottom-nav-bar.widget.dart:65:72)
      #1      BottomNavStyle3.build.<anonymous closure> (package:persistent_bottom_nav_bar_v2/nav-bar-styles/style-3-bottom-nav-bar.widget.dart:164:32)
      #2      MappedListIterable.elementAt (dart:_internal/iterable.dart:413:31)
      #3      ListIterator.moveNext (dart:_internal/iterable.dart:342:26)
      #4      new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:189:27)
      #5      new _GrowableList.of (dart:core-patch/growable_array.dart:150:28)
      #6      new List.of (dart:core-patch/array_patch.dart:51:28)
      #7      ListIterable.toList (dart:_internal/iterable.dart:213:44)
      #8      BottomNavStyle3.build (package:persistent_bottom_nav_bar_v2/nav-bar-styles/style-3-bottom-nav-bar.widget.dart:171:20)

Highlighting current selected icon when using Neurmorphic style

Here's a screenshot of what I'm trying to achieve:
Bottom Navigation Icons

So far, this is what I actually have:
Bottom Navigation Icons - Current

As you can see, I don't have the labels nor can I tell which icon/screen is currently selected. The documentation shows the following two neumorphic styles:
Neumorphic
Neumorphic without subtitle

I don't actually see the "Neumorphic without subtitle" as an option when I'm looking at the available styles.

Here is the code I'm using to create one of the icons:

PersistentBottomNavBarItem(
        icon: const Icon(Icons.settings),
        title: ("Settings"),
        textStyle: const TextStyle(color: kPrimaryColor),
        activeColorPrimary: Colors.white,
        activeColorSecondary: kPrimaryColor,
        inactiveColorPrimary: kPrimaryColor,
        inactiveColorSecondary: Colors.white,
        onPressed: (_) {
          pushNewScreen(tabContext!,
              screen: SettingsScreen(),
              withNavBar: true,
},),

It seems only the activeColorPrimary and activeColorSecondary make a difference.

Any tips would be appreciated. Maybe I'm just not using the properties correctly?

Make nested navigation compatible PersistentBottomNavBar.

Hey @jb3rndt

Feature request:-
PersistentBottomNavBarV2 compatibility with nested navigation.

Sometimes you want to choose a page based on a route as well as the state of that screen, e.g. the currently selected tab. In that case, you want to choose not just the screen from a route but also the widgets nested inside the screen. That's called "nested navigation". The key differentiator for "nested" navigation is that there's no transition on the part of the page that stays the same, e.g. the app bar stays the same as you navigate to different tabs on this TabBarView:

Of course, you can easily do this using the TabBarView widget, but what makes this nested "navigation" is that the location changes, i.e. notice the address bar as the user transitions from tab to tab. This makes it easy for the user to capture a dynamic link for any object in the app, enabling deep linking.

Examples:-

Thanks for maintaining a great package 🫡

rebuilld

at keyboard height changed will be rebuild

Null check operator used on a null value

Hi

I got this error in firebase crashlytics report. But there is no issue on device.

Fatal Exception: FlutterError
Null check operator used on a null value. Error thrown Instance of 'ErrorDescription'.

persistent-tab-view.widget.dart - Line 744
_PersistentTabViewState.popAllScreens + 744

Device
Model:iPhone 6
Orientation: Portrait
RAM free: 129.84 MB
Disk free: 30.77 GB

Operating system
Version:12.5.5
Orientation: Portrait
Jailbroken:No

Crash
Date:14 Jun 2022, 21:09:04
App version:2.0.1 (28)

Flutter 3.0 migrations

Flutter 3.0 dropped and now WidgetBinding.instance isn't nullable anymore, so the non null assertion operator now generate a warning.

Error when adding navigator observer

Hello,

I added a navigator observer in my PersistentTabView.custom widget like this

 routeAndNavigatorSettings: CustomWidgetRouteAndNavigatorSettings(
            navigatorObservers: [StackNavigatorObserver()],
            onGenerateRoute: AppRouter.onGenerateRoute,
          ),

But when I switch tab I have this error :

'package:flutter/src/widgets/navigator.dart': Failed assertion: line 3232 pos 14: 'observer.navigator == null': is not true.

I don't know if it's a bug or if I miss something

Pop back to first screen for a given tab on change

I apologize if this is redundant - I'm relatively new to Flutter.

I'm trying to get the following behavior to work when I change tabs: I'd like the state of each tab to be preserved (stateManagement : true), but the tab to be reverted to the first screen when the tabs are changed.

So what I'd like is (from README)

Pop back to first screen in the navigation graph for a given tab:

Navigator.of(context).popUntil(ModalRoute.withName("/"));

However, I can't seem to get this work. I'm trying to override onPressed in PersistentBottomNavBarItem. I'm not sure what I'm doing wrong - am I not getting the right context?

PersistentBottomNavBarItem(
  icon: Icon(icon),
  title: captionString,
  activeColorPrimary: Colors.blue,
  inactiveColorPrimary: Colors.grey,
  inactiveColorSecondary: Colors.purple,
  routeAndNavigatorSettings: RouteAndNavigatorSettings(
      onGenerateRoute: RouteGenerator.generateRoute),
  onPressed: (context) {
    if (_currentIndex != index && _childContext != null) {
      //this is not working
      if (Navigator.of(_childContext!).canPop())
        Navigator.of(_childContext!)
            .popUntil(ModalRoute.withName("/"));
    }
    setState(() {
      _currentIndex = index;
      _controller.index = _currentIndex;
      _childContext = context;
    });
    _populateChildWidget(entry.key);
  },
)

The error I keep getting (I've tried this in different ways) is

'package:flutter/src/widgets/navigator.dart': Failed assertion: line 5140 pos 12: '_history.isNotEmpty': is not true.

floatingActionButton not visible

Hi,

I want to have floatingActionButton in the second screen of app, but this is not completely visible

how to reproduce


import 'package:flutter/material.dart';
import 'package:persistent_bottom_nav_bar_v2/persistent-tab-view.dart';

void main() => runApp(PersistenBottomNavBarDemo());

class PersistenBottomNavBarDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Persistent Bottom Navigation Bar Demo',
      home: MainMenu(),
    );
  }
}

class MainMenu extends StatefulWidget {
  MainMenu({Key key}) : super(key: key);

  @override
  _MainMenuState createState() => _MainMenuState();
}

class _MainMenuState extends State<MainMenu> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: ProvidedStyleExample(),
    );
  }
}

class ProvidedStyleExample extends StatefulWidget {
  ProvidedStyleExample({Key key}) : super(key: key);

  @override
  _ProvidedStyleExampleState createState() => _ProvidedStyleExampleState();
}

class _ProvidedStyleExampleState extends State<ProvidedStyleExample> {
  PersistentTabController _controller;

  @override
  void initState() {
    super.initState();
    _controller = PersistentTabController(initialIndex: 0);
  }

  List<Widget> _buildScreens() {
    return [
      Scaffold(
        appBar: AppBar(title: const Text('Navigation Bar Demo')),
        body: Container(
          color: Colors.red,
        ),
      ),
      Scaffold(
        floatingActionButton: FloatingActionButton(
          onPressed: () {},
        ),
        appBar: AppBar(title: const Text('Navigation Bar Demo')),
        body: Container(
          color: Colors.white,
        ),
      ),
    ];
  }

  List<PersistentBottomNavBarItem> _navBarsItems() {
    return [
      PersistentBottomNavBarItem(
        icon: Icon(Icons.home),
        title: "Home",
        activeColorPrimary: Colors.blue,
        inactiveColorPrimary: Colors.grey,
        inactiveColorSecondary: Colors.purple,
      ),
      PersistentBottomNavBarItem(
        icon: Icon(Icons.search),
        title: "Search",
        activeColorPrimary: Colors.teal,
        inactiveColorPrimary: Colors.grey,
      ),
    ];
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: PersistentTabView(
        context,
        controller: _controller,
        screens: _buildScreens(),
        items: _navBarsItems(),
        navBarHeight: kBottomNavigationBarHeight,
        bottomScreenMargin: 0.0,
        decoration: NavBarDecoration(colorBehindNavBar: Colors.indigo, borderRadius: BorderRadius.circular(20.0)),
        navBarStyle: NavBarStyle.style3, // Choose the nav bar style with this property
      ),
    );
  }
}

output

Screenshot2022_09_01_210930

can someone help to figure out how we can put floatingActionButton with FloatingActionButtonLocation.endFloat like this

Screenshot2022_09_01_212046

Using pushNewScreen don't open navigation bar

I am using the latest version: 4.1.8,
But using pushNewScreen I can't see the navigation bar when withNavBar set true.

            pushNewScreen(
              context,
              screen: CartPage(),
              withNavBar: true,
              pageTransitionAnimation: PageTransitionAnimation.cupertino,
            );

Tab 1 -> Sub page -> using pushNewScreen -> Tab 3
Tab 2
Tab 3
Tab 4
Can you help me from sub page from Tab 1 navigable to tab 3 where navigation bar shows up?

debugging text is print upon click

When i click on any tab to navigate
a text Blassssfhlksajkdös is always print
i think it is caused via package the original one didn't have this bug

Navbar hides when pushing a new screen from floatingActionButton.

So basically I want a floating action button to be present on all screen. For this I am implementing it like so:

PersistentTabView.custom(
      ...
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          pushNewScreen(
            context,
            screen: Container(
              color: Colors.red,
            ),
            withNavBar: true,
          );
        },
      ),
      ...
);

The issue is that when this new screen is pushed, the navbar becomes hidden even though the withNavBar: true property.
Is this by design or is this fixable?

How to use another persistent widget like a mini player on top of the Persistent Nav Bar

Hi, I was using a "DIY" navigation bar that allowed me to use a mini player and show it across screens through the use of a stack inside the main body. Regardless of the tab bar view, I was able to see my mini player. Since moving to this new package because of some unique features, I haven't been able to implement my mini player using the same technique. How can I go about this? I would like to have my mini player appear everywhere the bottom nav bar does.

See image below

Persistent mini player

call initState on each visit

Hi,

when using original Flutter BottomTabNavigation initState is called every time when visited. This allows to refresh data upon visit for example. However I can see that this plugin acts differently - calls initState only once on first visit. Is there a way to atchieve same behaviour - call initState on each visit?

Error coming when using Style 15

======== Exception caught by rendering library =====================================================
The following assertion was thrown during paint():
RenderBox was not laid out: RenderCustomPaint#7ebba relayoutBoundary=up9
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1979 pos 12: 'hasSize'

Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=2_bug.md

The relevant error-causing widget was: 
  PersistentTabView PersistentTabView:file:///D:/work/medbuddi/lib/ui/base_view/base_view.dart:24:16
When the exception was thrown, this was the stack: 
#2      RenderBox.size (package:flutter/src/rendering/box.dart:1979:12)
#3      RenderCustomPaint._paintWithPainter (package:flutter/src/rendering/custom_paint.dart:563:27)
#4      RenderCustomPaint.paint (package:flutter/src/rendering/custom_paint.dart:610:7)
#5      RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#6      PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#7      RenderClipPath.paint (package:flutter/src/rendering/proxy_box.dart:1725:17)
#8      RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#9      PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#10     RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:79:15)
#11     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#12     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#13     RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:79:15)
#14     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#15     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#16     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2844:15)
#17     RenderStack.paintStack (package:flutter/src/rendering/stack.dart:611:5)
#18     RenderStack.paint (package:flutter/src/rendering/stack.dart:627:7)
#19     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#20     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#21     RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:79:15)
#22     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#23     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#24     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#25     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#26     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#27     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#28     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#29     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#30     RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:79:15)
#31     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#32     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#33     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2844:15)
#34     RenderStack.paintStack (package:flutter/src/rendering/stack.dart:611:5)
#35     RenderStack.paint (package:flutter/src/rendering/stack.dart:627:7)
#36     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#37     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#38     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#39     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#40     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#41     RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:79:15)
#42     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#43     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#44     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#45     RenderDecoratedBox.paint (package:flutter/src/rendering/proxy_box.dart:2191:11)
#46     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#47     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#48     RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:79:15)
#49     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#50     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#51     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#52     RenderTransform.paint (package:flutter/src/rendering/proxy_box.dart:2419:17)
#53     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#54     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#55     RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:79:15)
#56     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#57     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#58     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2844:15)
#59     RenderStack.paintStack (package:flutter/src/rendering/stack.dart:611:5)
#60     RenderStack.paint (package:flutter/src/rendering/stack.dart:627:7)
#61     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#62     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#63     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#64     RenderDecoratedBox.paint (package:flutter/src/rendering/proxy_box.dart:2191:11)
#65     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#66     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#67     RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:79:15)
#68     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#69     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#70     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2844:15)
#71     RenderStack.paintStack (package:flutter/src/rendering/stack.dart:611:5)
#72     RenderStack.paint (package:flutter/src/rendering/stack.dart:627:7)
#73     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#74     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#75     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#76     RenderDecoratedBox.paint (package:flutter/src/rendering/proxy_box.dart:2191:11)
#77     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#78     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#79     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#80     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#81     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#82     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2844:15)
#83     RenderCustomMultiChildLayoutBox.paint (package:flutter/src/rendering/custom_layout.dart:408:5)
#84     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#85     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#86     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#87     _RenderInkFeatures.paint (package:flutter/src/material/material.dart:604:11)
#88     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#89     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#90     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#91     PaintingContext.pushLayer (package:flutter/src/rendering/object.dart:387:12)
#92     RenderPhysicalModel.paint (package:flutter/src/rendering/proxy_box.dart:1951:15)
#93     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#94     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#95     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#96     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#97     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#98     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#99     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#100    PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:141:11)
#101    PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:100:5)
#102    PaintingContext._compositeChild (package:flutter/src/rendering/object.dart:198:7)
#103    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:185:7)
#104    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#105    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#106    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#107    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#108    RenderTransform.paint (package:flutter/src/rendering/proxy_box.dart:2419:17)
#109    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#110    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#111    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#112    PaintingContext.pushLayer (package:flutter/src/rendering/object.dart:387:12)
#113    PaintingContext.pushOpacity (package:flutter/src/rendering/object.dart:608:5)
#114    RenderAnimatedOpacityMixin.paint (package:flutter/src/rendering/proxy_box.dart:1008:23)
#115    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#116    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#117    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#118    RenderTransform.paint (package:flutter/src/rendering/proxy_box.dart:2419:17)
#119    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#120    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#121    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#122    PaintingContext.pushLayer (package:flutter/src/rendering/object.dart:387:12)
#123    PaintingContext.pushOpacity (package:flutter/src/rendering/object.dart:608:5)
#124    RenderAnimatedOpacityMixin.paint (package:flutter/src/rendering/proxy_box.dart:1008:23)
#125    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#126    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#127    _RenderColoredBox.paint (package:flutter/src/widgets/basic.dart:7510:15)
#128    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#129    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#130    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#131    RenderTransform.paint (package:flutter/src/rendering/proxy_box.dart:2419:17)
#132    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#133    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#134    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#135    PaintingContext.pushLayer (package:flutter/src/rendering/object.dart:387:12)
#136    PaintingContext.pushOpacity (package:flutter/src/rendering/object.dart:608:5)
#137    RenderAnimatedOpacityMixin.paint (package:flutter/src/rendering/proxy_box.dart:1008:23)
#138    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#139    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#140    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#141    RenderTransform.paint (package:flutter/src/rendering/proxy_box.dart:2419:17)
#142    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#143    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#144    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#145    PaintingContext.pushLayer (package:flutter/src/rendering/object.dart:387:12)
#146    PaintingContext.pushOpacity (package:flutter/src/rendering/object.dart:608:5)
#147    RenderAnimatedOpacityMixin.paint (package:flutter/src/rendering/proxy_box.dart:1008:23)
#148    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#149    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#150    _RenderColoredBox.paint (package:flutter/src/widgets/basic.dart:7510:15)
#151    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#152    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#153    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#154    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#155    PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:141:11)
#156    PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:100:5)
#157    PaintingContext._compositeChild (package:flutter/src/rendering/object.dart:198:7)
#158    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:185:7)
#159    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#160    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#161    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#162    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#163    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#164    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#165    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#166    RenderOffstage.paint (package:flutter/src/rendering/proxy_box.dart:3475:11)
#167    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#168    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#169    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#170    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#171    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#172    _RenderTheatre.paintStack (package:flutter/src/widgets/overlay.dart:786:15)
#173    _RenderTheatre.paint (package:flutter/src/widgets/overlay.dart:804:7)
#174    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#175    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#176    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#177    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#178    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#179    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#180    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#181    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#182    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#183    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#184    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#185    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#186    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#187    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#188    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#189    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#190    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#191    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#192    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#193    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#194    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#195    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#196    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#197    _RenderLayoutBuilder.paint (package:flutter/src/widgets/layout_builder.dart:340:15)
#198    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#199    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#200    _RenderLayoutBuilder.paint (package:flutter/src/widgets/layout_builder.dart:340:15)
#201    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#202    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#203    RenderView.paint (package:flutter/src/rendering/view.dart:209:15)
#204    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#205    PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:141:11)
#206    PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:100:5)
#207    PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:995:29)
#208    RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:506:19)
#209    WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:892:13)
#210    RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:370:5)
#211    SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1146:15)
#212    SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1083:9)
#213    SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:997:5)
#217    _invoke (dart:ui/hooks.dart:151:10)
#218    PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:308:5)
#219    _drawFrame (dart:ui/hooks.dart:115:31)
(elided 5 frames from class _AssertionError and dart:async)
The following RenderObject was being processed when the exception was fired: RenderCustomPaint#7ebba relayoutBoundary=up9
...  parentData: <none> (can use size)
...  constraints: BoxConstraints(0.0<=w<=423.5, 0.0<=h<=51.0)
...  size: MISSING
...  painter: null
...  foregroundPainter: _ShapeBorderPainter#b8e93()
RenderObject: RenderCustomPaint#7ebba relayoutBoundary=up9
  parentData: <none> (can use size)
  constraints: BoxConstraints(0.0<=w<=423.5, 0.0<=h<=51.0)
  size: MISSING
  painter: null
  foregroundPainter: _ShapeBorderPainter#b8e93()
...  child: _RenderInkFeatures#82cc0 relayoutBoundary=up10
...    parentData: <none> (can use size)
...    constraints: BoxConstraints(0.0<=w<=423.5, 0.0<=h<=51.0)
...    size: MISSING
...    child: RenderFittedBox#819f3 relayoutBoundary=up11
...      parentData: <none> (can use size)
...      constraints: BoxConstraints(0.0<=w<=423.5, 0.0<=h<=51.0)
...      size: MISSING
...      fit: contain
...      alignment: Alignment.center
...      textDirection: ltr
...      child: RenderParagraph#569c3 relayoutBoundary=up12 NEEDS-PAINT
...        parentData: <none> (can use size)
...        constraints: BoxConstraints(unconstrained)
...        size: Size(0.0, 16.0)
...        textAlign: start
...        textDirection: ltr
...        softWrap: wrapping at box width
...        overflow: clip
...        locale: en_US
...        maxLines: unlimited
...        text: TextSpan
...          debugLabel: ((englishLike bodyMedium 2014).merge((blackMountainView bodyMedium).apply)).merge(unknown)
...          inherit: false
...          color: Color(0xff3aa2dc)
...          family: RedHatDisplay
...          size: 12.0
...          weight: 400
...          baseline: alphabetic
...          decoration: TextDecoration.none
...          ""
====================================================================================================

styles 15 and 16 throwing 'unexpected null value'

all styles working, except 15 and 16
The following TypeErrorImpl was thrown building AnimatedBuilder(animation: AnimationController#4c4a8(⏭ 1.000; paused)➩CurveTween(curve: Cubic(0.25, 0.10, 0.25, 1.00))➩Tween<double>(375 → 0)➩0, dirty, state: _AnimatedState#74505): Unexpected null value.
When the exception was thrown, this was the stack: C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 251:49 throw_ C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 528:63 nullCheck packages/persistent_bottom_nav_bar_v2/persistent-tab-view.widget.dart 503:79 [_buildScreen] packages/persistent_bottom_nav_bar_v2/persistent-tab-view.widget.dart 612:22 <fn> packages/persistent_bottom_nav_bar_v2/models/persistent-nav-bar-scaffold.widget.dart 414:57 <fn>

my code is the basic implementation

Widget build(BuildContext context) {
  return PersistentTabView(
    context,
    controller: controller!,
    screens: _buildScreens(),
    items: _navBarsItems(),
    resizeToAvoidBottomInset: true,
    navBarStyle: NavBarStyle.style16,
    backgroundColor: const Color(0xFFEFEFEF),
    itemAnimationProperties: const ItemAnimationProperties(
      duration: Duration(milliseconds: 200),
      curve: Curves.ease,
    ),
    screenTransitionAnimation: const ScreenTransitionAnimation(
      animateTabTransition: true,
      curve: Curves.ease,
      duration: Duration(milliseconds: 200),
    ),
  );
}

how to refresh page in bottom bar menu when using stateManagement: true

I'm having a problem with state Management: true. It doesn't update the page again, it only updates the first time and after that it keeps the state not updated.

body: PersistentTabView(
          context,
          controller: bottomTabcontroller,
          screens: pages,
          items: _navBarsItems(),
          confineInSafeArea: true,
          backgroundColor: Colors.white,
          handleAndroidBackButtonPress: true,
          resizeToAvoidBottomInset: true,
          stateManagement: true,
          hideNavigationBarWhenKeyboardShows: true,
          decoration: NavBarDecoration(
            borderRadius: BorderRadius.circular(10.0),
            colorBehindNavBar: Colors.white,
          ),
          popAllScreensOnTapOfSelectedTab: false,
          popActionScreens: PopActionScreensType.once,
          itemAnimationProperties: ItemAnimationProperties(
            duration: Duration(milliseconds: 200),
            curve: Curves.ease,
          ),
          screenTransitionAnimation: ScreenTransitionAnimation(
            animateTabTransition: true,
            curve: Curves.ease,
            duration: Duration(milliseconds: 200),
          ),
          navBarStyle: NavBarStyle.style6,
        )

Can we trigger navigator stack clearing when onItemSelected

It's very useful widget, thank you continus maintain on v2.
I have a request, can we add a setting on PersistentTabView that we can trigger navigator stack clearing when onItemSelected.
After trace code, it will trigger navigator stack clearing when tap selected tab again.
Can we add a setting that can trigger directly?

Icon with Notification badge not implemented.

Hey, @jb3rndt I'm trying to add a notification badge on Persistent Bottom Nav Bar V2 but it is not compatible.

My code

  PersistentBottomNavBarItem(
    icon: Stack(
      alignment: Alignment.center,
      children: const [
        Icon(
          Icons.chat_rounded,
        ),
        UnreadIndicator(),
      ],
    ),
    title: ("Chat"),
  ),

Preview
IMG_1688

I want like this
rVO5g

Animation types when switching tabs

Hi, thanks for continuing this package.
Is there a way to use different screen transition animation? (ex: Fade/Zoom)
Currently it's sliding left/right when tapping on the tabs.

How to always refresh Nav Items when navigation to them?

Is there a way to always refresh (run initState) when I am navigation back to one of the Bottom Nav items?

Example: I am in Tab1 then navigate deeper to another screen. When I pop the second screen I want the tab1 to refresh.

pushNewScreenWithRouteSettings / pushNewScreen not working from drawer menu

Hello,
Thanks for awesome package
here i am trying to redirect page from drawer menu.. when i use pushNewScreenWithRouteSettings / pushNewScreen it's showing full page & bottom navigation bar & top bar not showing..
image

image

Here you are using route like

PersistentBottomNavBarItem(
  icon: Icon(Icons.search),
  title: ("Search"),
  activeColorPrimary: Colors.teal,
  inactiveColorPrimary: Colors.grey,
  routeAndNavigatorSettings: RouteAndNavigatorSettings(
    initialRoute: '/',
    routes: {
      '/first': (context) => MainScreen2(),
      '/second': (context) => MainScreen3(),
    },
  ),
),

can you please explain me how can i redirect page via route like "search/second"

image

Please help me

How to extend the body's of screens past the NavBar?

So basically I am using this package for the first time and it really is amazing. So much is included out of the box.

I believe this is a missing feature and not a bug. Essentially, when I declare PersistentTabView.custom(...), I'd like the screens that I defined in the PersistentTabView to extend past the body making the content of the current screen extend past the navbar.

Is this already possible and I'm just not seeing it or is this a missing feature?

Thank you!

Restore page removed with "pushReplacement"

Hello everybody,

My app starts with login.
Once authenticated, I remove the login page with "Navigator.pushReplacement".
When I log out, of course I no longer return to the login page with "Navigator.of (context, rootNavigator: true) .pop ();".
How can I solve this problem?

Many thanks in advance.

When using an image from an asset, control size of said image

BilalShahid13#138 (comment)

Since there is actually some maintenance going on.

Do you think you can solve this one?

So for example (under style 3)

      PersistentBottomNavBarItem(
        icon: ImageIcon(
          AssetImage('assets/nav/news.png'),
          color: Colors.white,
          size: 512,
        ),
        iconSize: 30,
        title: "News",
        activeColorPrimary: Color.fromRGBO(101, 21, 24, 1),
        inactiveColorPrimary: Colors.grey,
        inactiveColorSecondary: Colors.purple,
      ),

Results in a tiny icon and regardless of size or iconSize the icon on the nav bar is pidly small and will not change size at all

basically looks like what is reported in BilalShahid13#254

Using Go Router with PersistentBottomNavBar

I'm building a new app in Flutter with Go_Router and PersistentBottomNavBar (Since all new recipes point to Go_Router as the go-to navigation solution). Is there an option to integrate Go_Router with PersistentBottomNavBar?
If I do something like pushNewScreenWithRouteSettings( context, screen: ProductsListScreen(), settings: RouteSettings(name: "/products"), );,
the page isn't pushed to the stack of Go_Router.

How to add a screen to another tab by pressing a button in the screen?

Persistent Behavior
In the sample app as shown in the video, how do I add a screen to the stack by pressing the button in the center of the screen and moving from the Home tab to the magnifying glass tab on the right side?

Switching tabs from within the screen could be done using PersistentTabController.

How do I add any screen to the screen stack of another tab?

IOS Issue with PersistentTabView

Issue with ios only while change statusBarColor it doesn't update for all derived widgets or widget of PersistentTabView,
only works if hide PersistentTabView or remove it from widget.
it works with android only as in this image
image

Excellent project.

Hi, all right, I'm from Brazil, I was happy to know that you are continuing to maintain the "Bilal Shahid13" project, great initiative. I'm new to flutter and I'm studying this project.
It uses multi-stack navigation, a question how to get a button on the Settings page, and by clicking change to the search stack. Did you get it. haha

My English is not good, so I used the translator.

Back navigation in AppBar when using Drawer

Hi,

I would like to use the bottom navigation bar and a drawer for the case that navigation within one tab provides the back button instead of the drawer. So I have 2 tabs of which the first one has a subpage to which I can navigate:

Tab1 -> Tab1Detail
Tab2

When the user is seeing Tab1 or Tab2 the drawer should be shown and when the user is on Tab1Detail the back button instead of the drawer should be shown. I checked the example code of the project, but even with that code the back button does not appear when navigating to MainScreen2 or MainScreen3.
The preview yet shows on navigation to MainScreen2 that the back button appears, so I'm not sure if I'm missing something or this is not supported (anymore?).

I tried both using Navigator.of(context).pushNamed() as well as the pushNew() / pushNewScreenWithRouteSettings().

Code is from the example but trimmed down.

main.dart:


void main() {
  runApp(const ExampleApp());
}

class ExampleApp extends StatelessWidget {
  const ExampleApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
      return MaterialApp(title: 'StreamedUp',
          theme: ThemeData(
            primarySwatch: Colors.blue,
          ),
          home: TabExample(),
     );
  }
}

TabPage:

class TabExample extends StatefulWidget {
  const TabExample({Key? key}) : super(key: key);

  @override
  _TabExampleState createState() => _TabExampleState();
}

class _TabExampleState extends State {
  late PersistentTabController _controller;

  @override
  void initState() {
    super.initState();
    _controller = PersistentTabController(initialIndex: 0);
  }

  List _buildScreens() {
    return [
      MainScreen(),
      MainScreen(),
    ];
  }

  List _navBarsItems() {
    return [
      PersistentBottomNavBarItem(
        icon: Icon(Icons.home),
        title: "Home",
        activeColorPrimary: Colors.blue,
        inactiveColorPrimary: Colors.grey,
        inactiveColorSecondary: Colors.purple,
        routeAndNavigatorSettings: RouteAndNavigatorSettings(
          initialRoute: '/',
          routes: {
            '/first': (context) => MainScreen2(),
          },
        ),
      ),
      PersistentBottomNavBarItem(
        icon: Icon(Icons.search),
        title: ("Search"),
        activeColorPrimary: Colors.teal,
        inactiveColorPrimary: Colors.grey,
      ),
    ];
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Navigation Bar Demo')),
      drawer: Drawer(
        child: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              const Text('This is the Drawer'),
            ],
          ),
        ),
      ),
      body: PersistentTabView(
        context,
        controller: _controller,
        screens: _buildScreens(),
        items: _navBarsItems(),
        hideNavigationBar: false,
        popAllScreensOnTapOfSelectedTab: true,
        itemAnimationProperties: ItemAnimationProperties(
          duration: Duration(milliseconds: 400),
          curve: Curves.ease,
        ),
        screenTransitionAnimation: ScreenTransitionAnimation(
          animateTabTransition: true,
          curve: Curves.ease,
          duration: Duration(milliseconds: 200),
        ),
        navBarStyle:
            NavBarStyle.style13, // Choose the nav bar style with this property
      ),
    );
  }
}

MainScreen:

class MainScreen extends StatelessWidget {
  const MainScreen({
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.indigo,
      body: Center(
        child: ElevatedButton(
          onPressed: () {
            pushNewScreenWithRouteSettings(
              context,
              settings: RouteSettings(name: '/home'),
              screen: MainScreen2(),
              pageTransitionAnimation: PageTransitionAnimation.scaleRotate,
            );
          //Alternatively tried: Navigator.pushNamed(context, '/first'), but also not working
          },
          child: Text(
            "Go to Second Screen ->",
            style: TextStyle(color: Colors.white),
          ),
        ),
      ),
    );
  }
}

MainScreen2:

class MainScreen2 extends StatelessWidget {
  const MainScreen2({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.teal,
      body: Container(
        child: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              ElevatedButton(
                onPressed: () {
                  Navigator.pop(context);
                },
                child: Text(
                  "Go Back to First Screen",
                  style: TextStyle(color: Colors.white),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

I also tried using the endDrawer and the solution suggested here, but it didn't work either.

Display Nav Bar after withNavBar: false

Using pushNewScreen(context, screen: screen, withNavBar: false) works as intended but from there if I use pushNewScreen again the bottom nav bar is not brought back. Anyway to show the nav bar again while still keeping the Navigation stack so pop will work correctly?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.