title: Bottom navigation bar disappears while navigating with the url in flutter
body: <p>My navigation bar works very well when I click on it. When I try to navigate to the pages with the url such as &quot;http://localhost:5000/#/profile&quot; bottom nav bar disappears. I want my navigation bar to stay in the pages where navigation is possible with it. I think I should add the nav bar somehow to the profile page too, but I couldn't find it out.</p>
  <pre><code>const String HomeRoute = '/';
  const String ProfileRoute = '/profile';
  
  void main() async {
    WidgetsFlutterBinding.ensureInitialized();
    await Firebase.initializeApp();
    runApp(MyApp());
  }
  
  class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return MultiProvider(
        providers: [
          ChangeNotifierProvider.value(value: DbProvider()),
          ChangeNotifierProvider.value(
            value: ThemeChanger(ThemeData.light()),
          )
        ],
        child: MaterialAppWithTheme(),
      );
    }
  }
  
  class MaterialAppWithTheme extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      final theme = Provider.of&lt;ThemeChanger&gt;(context);
      return MaterialApp(
        initialRoute: HomeRoute,
        routes: {
          HomeRoute: (context) =&gt; HomePage(),
          ProfileRoute: (context) =&gt; Profile(),
        },
        theme: theme.getTheme(),
      );
    }
  }
  
  class HomePage extends StatefulWidget {
    @override
    _HomePageState createState() =&gt; _HomePageState();
  }
  
  class _HomePageState extends State&lt;HomePage&gt; {
    int menuItem = 0;
    List&lt;Widget&gt; allPages;
    Home home;
    Profile profile;
    Favorites favorites;
    Offers offer;
  
    FirebaseAuth firebaseAuth = FirebaseAuth.instance;
    User currentUser;
    @override
    void initState() {
      if (mounted) {
        super.initState();
        home = Home();
        profile = Profile();
        favorites = Favorites();
        offer = Offers();
        allPages = [home, offer, favorites, profile];
      }
    }
      
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        body: allPages[menuItem],
        bottomNavigationBar: bottomNavMenu(),
      );
    }
  
    Theme bottomNavMenu() {
      return Theme(
        data: ThemeData(
            canvasColor: Colors.blue.shade900, primaryColor: Colors.orangeAccent),
        child: BottomNavigationBar(
          items: &lt;BottomNavigationBarItem&gt;[
            BottomNavigationBarItem(
              icon: Icon(Icons.home),
              label: 'Main',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.local_offer),
              label: 'Offer',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.favorite_outlined),
              label: 'Favs',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.person_outlined),
              label: 'Profile',
            ),
          ],
          type: BottomNavigationBarType.shifting,
          currentIndex: menuItem,
          onTap: (index) {
            setState(() {
              menuItem = index;
            });
          },
        ),
      );
    }
  }
  
  
  class Profile extends StatefulWidget {
    @override
    _ProfileState createState() =&gt; _ProfileState();
  }
  
  class _ProfileState extends State&lt;Profile &gt; {
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(title: Text('Profile')),
        body: Center(
          child: Text(&quot;Profile),
        ),
      );
    }
  }
  </code></pre>