考虑我的场景
//Show the progress indicator inside an alert to block the user
showAlertProgressIndicator();
// Get the data
await DataManager.get().getDummyData().then((value){
// After data acquisition pop the alertProgressIndicator
});
我怎样才能实现这个目标?
最佳答案
我觉得应该很简单
Navigator.pop(context);
或
void closeAlert() {
Navigator.pop(context);//it will close last route in your navigator
}
我猜这两个方法在同一个 build()
中。所以它们有相同的 BuildContext
,所以上面的应该可以工作。
关于dart - 如何从构建器外部在 Flutter 上弹出警报对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51558561/