flutter 实现返回刷新

发布时间:2024-04-17 09:28:17

如新增、修改数据后反回需要对页面刷新,需要将跳转的方式改为如下:

 Navigator.of(context,rootNavigator: true).push(MaterialPageRoute(
              builder: (BuildContext context) {
                return const GiftBookAdd();
              }
          )).then((value) => loadData(_initcount));

核心代码是:

.then((value) => loadData(_initcount));  //loadData为重新加载

Card image cap
APP STORE
Card image cap
应用宝
Card image cap
小米
Card image cap
华为