flutter - 从另一个屏幕移回屏幕后颤动调用一个函数
问题描述
从另一个屏幕移回一个屏幕后,如何在颤振中调用一个函数?
例如:
屏幕一
function1(){
}
屏幕2
function2(){
//Go back to screen 1 and then call function1()
}
解决方案
这很简单。
Navigator.push(context, MaterialPageRoute(builder: (context)=> SecondScreen())).then((_){
// This method gets callback after your SecondScreen is popped from the stack or finished.
function1();
});
推荐阅读
- api-gateway - Kong api 网关返回 404 未找到,而不是消息:没有路由,也没有找到具有这些值的 API
- ios - 如何设置 UIContextualAction 的圆角半径?
- c++ - 围绕它自己的 y 轴旋转相机
- python - 如何在数据框中选择不在熊猫系列数组中的行?
- reactjs - 在一个项目中编写 React 组件并在同一台计算机上的另一个项目中同步它们
- sql - 当我尝试在 PostgreSQL 中创建函数时,我得到 ERROR: syntax error at or near "BEGIN"
- python - 结合字典和列表
- javascript - 是否有 Eslint 规则不让条件和条件主体具有相同的缩进?
- node.js - Node.js 请求模块获取间歇性 401 响应
- javascript - 如何返回 Promise.all 获取 api json 数据?