问题描述
class _ParentState extends State<ParentOverview> {
String title = "" ;
List<String> pageTitles = [
"Page 1","Page 2",] ;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Expenses"),centerTitle: true,actions: [
Padding(
padding: EdgeInsets.only(right: 20),child: InkWell(
child: Icon(Icons.refresh),onTap: (() {
// Todo
}),),],body: PageView(
scrollDirection: Axis.vertical,children: [
ChildPage1(),ChildPage2(),onPageChanged: ((selectedPage) {
setState(() {
title = pageTitles[selectedPage] ;
});
}),);
}
}
PageView
的孩子是StatefulWidget
。
此父页面包含一个AppBar
以及一个用于重新加载的按钮。
单击此按钮时,我要拨打电话以重新加载Page1和Page2中包含的数据。
我该如何实现?
有人告诉我使用Provider
,但这是最好的方法吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)