I have this code to manage the bottomNavigationBar, but every time I tap to change page flutter rebuild the widget, how can I not do it?
class _HomePageState extends State<HomePage>{
int _pageIndex = 0;
List<Widget> pages = [];
@override
void initState() {
super.initState();
pages.add(PostListPage());
pages.add(MessagesPage());
pages.add(ProfilePage());
pages.add(SettingsPage());
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("CFA"),
centerTitle: true
),
body: pages[_pageIndex],
bottomNavigationBar:buildNavigationBar()
);
}
}