Keep the BottomAppBar when pushing a new screen

I’m developing a Flutter app that has always a BottomAppBar visible with just two tabs.
Navigating through these two tabs is working fine, but I would like to push a new screen while tapping on the appBar and on one of the tile I have on one of the tab.

I’ve already tryied the Navigator but, when pushing a new screen, the BottomAppBar disappear

Here is the relevant code:

main.dart

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: 'DemoApp',
        debugShowCheckedModeBanner: false,
        theme: ThemeData(
            primaryColor: ...,
        home: HomePage());
  }
}

home_page.dart

  Widget build(BuildContext context) {
    return Scaffold(
        appBar: new AppBar(
          title: new Text('DemoApp'),
          actions: <Widget>[
            IconButton(
              icon: Icon(Icons.account_circle),
              tooltip: "Account settings",
              onPressed: () {
                Navigator.push(context, MaterialPageRoute(builder: (context) => UserDetail('test')));
              },
            )
          ],
        ),
        body: WalletTab(),
        bottomNavigationBar: FABBottomAppBar(
          color: Theme.of(context).primaryColorLight,
          onTabSelected: _selectedTab,
          selectedColor: Theme.of(context).primaryColor,
          notchedShape: CircularNotchedRectangle(),
          items: [
            FABBottomAppBarItem(iconData: Icons.home, text: 'Wallet'),
            FABBottomAppBarItem(iconData: Icons.location_on, text: 'Store')
          ],
        ),
        floatingActionButton: FloatingActionButton(
            onPressed: () {},
            tooltip: '',
            ),
        floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
        resizeToAvoidBottomPadding: false);
  }
}

Any advice?
Thank you

Leave a Reply

Your email address will not be published. Required fields are marked *