dismiss static method

Future<void> dismiss({
  1. SmartStatus? status,
  2. String? tag,
  3. @deprecated int closeType = 0,
})

It is recommended to use the status param, and keep the closeType param for compatibility with older versions

status:SmartStatus.dialog(only close dialog),SmartStatus.toast(only close toast), SmartStatus.loading(only close loading)。 note: the closeType param will become invalid after setting the value of the status param。

closeType:0(default:close loading,custom or attach),1(only close dialog),2(only close toast), 3(only close loading),other(all close)

tag:if you want to close the specified dialog, you can set a 'tag' for it


推荐使用status参数,保留closeType参数,是为了兼容旧版本用法

status:SmartStatus.dialog(仅关闭dialog),SmartStatus.toast(仅关闭toast), SmartStatus.loading(仅关闭loading)。 注意:status参数设置值后,closeType参数将失效。

closeType:0(默认:关闭loading,custom或attach),1(仅关闭dialog),2(仅关闭toast), 3(仅关闭loading),other(全关闭)

tag:如果你想关闭指定的dialog,你可以给它设置一个tag

Implementation

static Future<void> dismiss({
  SmartStatus? status,
  String? tag,
  @deprecated int closeType = 0,
}) async {
  var instance = DialogProxy.instance;
  if (status == null) {
    if (closeType == 0) {
      await instance.dismiss(status: SmartStatus.smart, tag: tag);
    } else if (closeType == 1) {
      await instance.dismiss(status: SmartStatus.dialog, tag: tag);
    } else if (closeType == 2) {
      await instance.dismiss(status: SmartStatus.toast);
    } else if (closeType == 3) {
      await instance.dismiss(status: SmartStatus.loading);
    } else {
      await instance.dismiss(status: SmartStatus.loading);
      await instance.dismiss(status: SmartStatus.allDialog, tag: tag);
      await instance.dismiss(status: SmartStatus.toast);
    }
    return;
  }

  await instance.dismiss(status: status, tag: tag);
}