title: BottomNavigationBar and Provider?
body: <p>I used the bottom navigation bar and added 3 buttons to the bottom.I was swapping pages with setsate. These buttons work fine. But if I call another page inside the pages called with those buttons, the BottomNavigationBar disappears. I've researched it and found this <a href="https://berkanaslan.com/yazilim/flutterda-provider-ile-bottomnavigationbar-mimarisi/" rel="nofollow noreferrer">click me</a>. Is it logical to use Provider to call pages? I think it keeps every page in memory, doesn't it consume too much ram?</p>
  <pre><code> import 'package:flutter/material.dart';
  
  class HomePage extends StatefulWidget {
    @override
    _HomePageState createState() =&gt; _HomePageState();
  }
  
  class _HomePageState extends State&lt;HomePage&gt; {
    int selectedPage = 0;
  
    final _pageOptions = [
      HomeScreen(),
      InboxScreen(),
      SignInScreen()
    ];
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
          backgroundColor: Colors.white,
          body: _pageOptions[selectedPage],
          bottomNavigationBar: BottomNavigationBar(
            items: [
              BottomNavigationBarItem(icon: Icon(Icons.home, size: 30), title: Text('Home')),
              BottomNavigationBarItem(icon: Icon(Icons.mail, size: 30), title: Text('Inbox')),
              BottomNavigationBarItem(icon: Icon(Icons.account_circle, size: 30), title: Text('Account')),
            ],
            selectedItemColor: Colors.green,
            elevation: 5.0,
            unselectedItemColor: Colors.green[900],
            currentIndex: selectedPage,
            backgroundColor: Colors.white,
            onTap: (index){
              setState(() {
                selectedPage = index;
              });
            },
          )
      );
    }
  }
  </code></pre>
  <p>This is my home page.BottomNavigationBar disappears If I clicked on the text</p>
  <pre><code>class _HomePage extends State&lt;HomePage&gt; {
    @override
    Widget build(BuildContext context) {
      // TODO: implement build
      return Scaffold(appBar: AppBar(title: Text('Page2')),body:GestureDetector(
          onTap: () {
      
              Navigator.of(context).push(MaterialPageRoute(builder: (context) =&gt; NewScreen()));
  
          },
          child:Text('clik')));
    }
  }
  </code></pre>
  <p>I want to like this
  <a href="https://i.stack.imgur.com/NOx0f.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NOx0f.png" alt="I want to this" /></a>
  But my code run this
  <a href="https://i.stack.imgur.com/vaSTu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vaSTu.png" alt="not this" /></a></p>