I have a menu page which has tabA and tabB. The appBar has a search button.
menu.dart
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Item List'),
actions: [
_currentIndex == 0
? Row(
children: [
IconButton(
onPressed: () {
Navigator.pushNamed(context, SearchScreen.ROUTE,
arguments: list);
},
icon: Icon(
Icons.search,
color: Colors.white,
)),
IconButton(
icon: Icon(
Icons.tune,
color: Colors.white,
),
onPressed: () {
...
}
}
});
},
)
],
)
: Container()
],
bottom: TabBar(
unselectedLabelColor: Colors.white,
labelColor: Colors.white,
isScrollable: false,
tabs: <Widget>[
Tab(
text: "Tab A",
),
Tab(
text: "Tab B",
),
],
controller: _tabController,
indicatorColor: Colors.white,
indicatorSize: TabBarIndicatorSize.tab,
),
bottomOpacity: 1,
),
body: TabBarView(
controller: _tabController,
children: <Widget>[
ShowTabA(),
ShowTabB()
],
),
);
}
}
In tabA, it has a listView. When I tap on one of the listview item, it will navigate to EditPage. When return from EditPage, I will refresh the data in tabA. All the list item will be updated.
tabA.page
initState(){
_bloc.getItemList();
}
Navigator.pushNamed(EditPage.ROUTE,context).then((onValue){
_bloc.getItemList();
});
My problem here:
When I click the search icon in menu page , it will navigate to SearchScreen page.Once user click the list item in SearchScreen, it will navigate to EditPage.
When back from EditPage, I want the list in TabA page refreshed but it can't because I navigate using pushReplacementNamed in menu page . How to achieve that ?
SearchScreen.dart
Navigator.pushReplacementNamed(context);
_bloc.getItemList();not getting called once it back from EditPage.