title: Flutter pageview widget change the screens parameter and render it, but it doesn't work
body: <p>I have created an Pageview for my application where I have 3 screens in</p>
  <pre class="lang-dart prettyprint-override"><code> class Dashboard extends StatefulWidget {
    @override
    _DashboardState createState() =&gt; _DashboardState();
  }
  
  class _DashboardState extends State&lt;Dashboard&gt; {
  
    int bottomNavIndex = 0;
    PageController pageController = PageController(initialPage: 0, keepPage: true);
    static String title = &quot;What we offer&quot;;
    bool isCollapsed = false
    static Widget home = WhatWeOffer();
  
    static List&lt;Widget&gt; screens = [
      home,
      CourseName(),
      AboutUsScreen(),
    ];
  
    static List&lt;String&gt; titles = [
      title,
      &quot;Courses&quot;,
      &quot;About us&quot;,
    ];
  
    @override
    void initState() {
      super.initState();
    }
  
  
    void onHomeChanged (String newTitle, Widget newWidget){
      setState(() {
        home = newWidget;
        title = newTitle;
        // pageViewKey.currentState.widget;
      });
    }
  
    void onPageChanged (int index){
      setState(() {
        bottomNavIndex = index;
        title = titles[index];
        // log(&quot;page changed $bottomNavIndex  $index&quot;);
      });
    }
  
  
  
  @override
    Widget build(BuildContext context) {
      return WillPopScope(
        onWillPop: _onPopScope,
        child: Stack(
          children: [
  
  
            /// Drawer
            Container(
              color: Colors.white,
              width: 0.6*Device.width,
              child: Drawer(
                  child: ListView(
                    // Important: Remove any padding from the ListView.
                    padding: EdgeInsets.zero,
                    children: &lt;Widget&gt;[
                      SizedBox(height : 30),
                      DrawerHeader(
                        decoration: BoxDecoration(
                          border: Border(bottom: BorderSide(color: Device.appColor, width: 3.0)),
                          image: DecorationImage(fit: BoxFit.fitWidth, image : AssetImage('assets/images/logo_with_text.jpg')),
                        ),
  
                        // TODO: add hello user
                        child: Stack(
                            children: [
                              Positioned(bottom : 5.0,child: Text('')),
                            ]
                        ),
                      ),
  
  
                      ListTile(
                        leading: FaIcon(FontAwesomeIcons.gavel),
                        title: Text('Terms &amp; Conditions'),
                        onTap: () {
                          /// carefully change the onPageChanged index
                          onHomeChanged(&quot;Terms &amp; Conditions&quot;,TnC());
                          onPageChanged(0);
                          pageController.jumpToPage(bottomNavIndex);
                          isCollapsed = false;
                          // Navigator.pushNamed(context, '/tnC');
                        },
                      ),
  
  
                    ],
                  )
  
              ),
            ),
            AnimatedPositioned(
              top: isCollapsed ? 0.0*Device.height : 0,
              bottom: isCollapsed ? 0.0*Device.height : 0,
              left : isCollapsed ? 0.6*Device.width : 0,
              right : isCollapsed ? -0.4*Device.width : 0,
              duration: Duration(milliseconds: 300),
              child: Scaffold(
  
              appBar: AppBar(
                leading: IconButton(
                  icon: Icon(Icons.menu),
                  onPressed: () {
                    setState(() {
                      isCollapsed = !isCollapsed;
                    });
                  },
                ),
                backgroundColor: Device.appColor,
                title: Text(
                  title,
                  style: TextStyle(
                    color: Colors.white,
                    fontWeight: FontWeight.bold,
                    fontSize: 20,
                  ),
                ),
                centerTitle: true,
              ),
              
  
              body: PageView(
                // key: pageViewKey,
                children: screens,
                controller: pageController,
                onPageChanged: onPageChanged,
              ),
  
  
              bottomNavigationBar: CurvedNavigationBar(
                buttonBackgroundColor: Colors.green,
                animationCurve: Curves.easeInOutCirc,
                height: 50,
                color: Device.appColor,
                index: bottomNavIndex,
                backgroundColor: Device.whiteColor,
                items: [
                  Icon(Icons.home_filled, color : Colors.white),
                  FaIcon(FontAwesomeIcons.book, color : Colors.white),
                  Icon(Icons.person_pin, color : Colors.white),
                ],
  
                onTap: (index) =&gt; setState(() {
                bottomNavIndex = index;
                pageController.jumpToPage(bottomNavIndex);
                }),
              ),
                
  
          ),
            ),
      ]
        ),
      );
    }
  </code></pre>
  <p>[Code][1]</p>
  <p>I have a drawer which has various list tiles and I want that on click of a tile, I want to replace the first screen of my pageview with new widget, for this change I have created a parameter home and passed to screens list as shown in code.</p>
  <p>I have created a function onHomeChanged for that:</p>
  <p>But on clicking it i still see the old widget there?
  How do I achieve replacing the old widget with new widget?</p>
  <p>I think the pageview widget has created the widget in the memory which is not replaced further, what is the solution to it.</p>
  <p>I have tried using pageview key i.e global key, but I am not confident on it, guide me.</p>