title: Flutter Custom Navigation Bar
body: <p>i have a problem with a custom navigation bar.
  I can´t change the page in the body. I put 4 diferent texts for tests.
  Later i want to have somo widgets with the diffrent pages.
  The _buildItem is in a diferent widget but in the same page.</p>
  
  <pre><code>class InicioPage extends StatefulWidget {
  final int selectedIndex = 0;
    @override
    State&lt;StatefulWidget&gt; createState() {
      return InicioPageState(selectedIndex);
    }
  }
  
  class InicioPageState extends State&lt;InicioPage&gt; {
    int selectedIndex;
    InicioPageState(this.selectedIndex);
  
    final pages = [Text('page 0'),Text('page 1'),   ];
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          elevation: 1,
          title: Text('Title of App'),     ),
        bottomNavigationBar: BottomNavBar(selectedIndex),
        body: pages[selectedIndex],      );     }    }
  </code></pre>
  
  <p>Here is the Navigation Bar. I cut some parts that are not important because the characters.</p>
  
  <pre><code>class BottomNavBar extends StatefulWidget {
    final int selectedIndex;
    BottomNavBar(this.selectedIndex);
    @override
    State&lt;StatefulWidget&gt; createState() {
      return BottomNavBarState(selectedIndex);
    },}
  
  class BottomNavBarState extends State&lt;BottomNavBar&gt; {
    int selectedIndex;
     BottomNavBarState(this.selectedIndex);
      List&lt;NavigationItem&gt; items = [
      NavigationItem(Icon(Icons.home), Text('Home')),
      NavigationItem(Icon(Icons.location_city), Text('Props')),
        ];
   @override
    Widget build(BuildContext context) {
      return Container(
      child: Row(
      children: items.map((item) { var itemIndex = items.indexOf(item);
      return GestureDetector(  onTap: () {   setState(() {
                    selectedIndex = itemIndex;
                  });           },
                child: _buildItem(item, selectedIndex == itemIndex),
              );
            }).toList(),
          ));
    }
  }
  </code></pre>