closeAllDialogsExcept static method

void closeAllDialogsExcept(
  1. Set<String> preservedKeys, {
  2. DialogReturnTypeEnum? returnType,
})

关闭除指定 key 之外的所有弹窗

Implementation

static void closeAllDialogsExcept(
  Set<String> preservedKeys, {
  DialogReturnTypeEnum? returnType,
}) {
  final keys = List<String>.from(_dialogContexts.keys);
  final keysToClose =
      keys.where((key) => !preservedKeys.contains(key)).toList();
  TCICLog.info(
    'Closing dialogs except $preservedKeys, count: ${keysToClose.length}',
    actionModule: ActionModule.tools.name,
    actionName: ActionName.showModalDailog.name,
  );

  for (final key in keysToClose) {
    final contexts = _dialogContexts[key];
    if (contexts != null && contexts.isNotEmpty) {
      closeModalDailog(
        contexts.first,
        key,
        returnType: returnType,
        closeAll: true,
      );
    }
  }
}