📜  如何在底页颤动中更改状态 - 无论代码示例

📅  最后修改于: 2022-03-11 15:00:04.498000             🧑  作者: Mango

代码示例1
downloadFiles(String imageUrl, String subjectName, String fileName) async {
    setState(() {
      loading = true;
      progress = 0;
    });
    bool downloaded = await saveFile(imageUrl, subjectName, fileName);
    if (downloaded) {
      MessageDialog()
          .showMessageDialogPrimary(context, 'Downloaded successfully');
    } else {
      MessageDialog().showMessageDialogPrimary(context, 'Something went wrong');
    }
    setState(() {
      loading = false;
    });
  }