我正在使用 progress_dialog 1.2.0 包在我的应用程序中显示进度对话框,它在我调用 pr.show() 时显示,但在我调用 pr.hide() 时没有隐藏。
onTap: () async {
pr.show();
print('clicked custom category');
print(categorylist[index].catName);
print(categorylist[index].catId);
// await getAllProductsInCategory(categorylist[index].catId);
setState(() {
catId = categorylist[index].catId;
myinitlist.clear();
myinitlist = List.from(productList);
pr.hide();
});
},
当我取消注释“getAllProductsInCategory()”函数时,它会隐藏对话框。
谁能帮我这个。
先感谢您。
最佳答案
尝试:
onTap: () async {
pr.show();
print('clicked custom category');
print(categorylist[index].catName);
print(categorylist[index].catId);
setState(() {
catId = categorylist[index].catId;
myinitlist.clear();
myinitlist = List.from(productList);
Future.delayed(Duration(seconds: 3)).then((value) {
pr.hide().whenComplete(() {
print(pr.isShowing());
});
});
});
},
或者 :
onTap: () async {
pr.show();
print('clicked custom category');
print(categorylist[index].catName);
print(categorylist[index].catId);
Future.delayed(Duration(seconds: 3)).then((value) {
setState(() {
catId = categorylist[index].catId;
myinitlist.clear();
myinitlist = List.from(productList);
pr.hide().whenComplete(() {
print(pr.isShowing());
});
});
});
},
关于Flutter:进度对话框没有隐藏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58494494/