show static method

void show(
  1. int level,
  2. OverlayPortalController controller, {
  3. Object? rootId,
  4. Object? parentRootId,
})

Show a level controller for a given menu root. If parentRootId is null and level == 0, this is treated as a top-level root and closes any unrelated top-level menus.

Implementation

static void show(
  int level,
  OverlayPortalController controller, {
  Object? rootId,
  Object? parentRootId,
}) {
  final effectiveRoot = rootId ?? _defaultRoot;
  final state = _getOrCreateState(effectiveRoot, parentRootId: parentRootId);

  // If opening a new top-level root menu, hide all unrelated root trees
  if (level == 0 && parentRootId == null) {
    hideAllExcept(effectiveRoot);
  }

  hideDeeperThan(level - 1, rootId: effectiveRoot);
  state.activeByLevel[level] = controller;
  controller.show();
}