I make bottomNavigationBar like below
List<Widget> pages = [
Dashboard(),
AllServices(),
InformationPage(),
];
int _selectedIndex = 0;
Widget _bottomNavigationBar(int selectedIndex) {
return BottomNavigationBar(
onTap: (int index) => setState(() => _selectedIndex = index),
currentIndex: selectedIndex,
type: BottomNavigationBarType.fixed,
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: new Icon(Icons.home),
title: new Text("Dashboard"),
),
BottomNavigationBarItem(
icon: new Icon(Icons.location_on),
title: new Text("AllServices"),
),
BottomNavigationBarItem(
icon: new Icon(Icons.person),
title:new Text("InformationPage"),
],
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
bottomNavigationBar: _bottomNavigationBar(_selectedIndex),
body: pages[_selectedIndex],
);
}
Every thing is correct if user navigates between pages, but AllServices class has two conditions to render two different widgets, I want if user in AllServices page again ontap AllServices bottom navigate AllServices page again rebuild but ontap does not work for same page to rebuild it again how can I solve this problem?