hideRoot static method
Hides a specific root and all its descendant roots.
Implementation
static void hideRoot(Object? rootId) {
final key = rootId ?? _defaultRoot;
final state = _roots[key];
if (state == null) return;
state.closeTimer?.cancel();
for (final controller in state.activeByLevel.values) {
if (controller.isShowing) {
controller.hide();
}
}
state.activeByLevel.clear();
state.hoveredLevels.clear();
state.isTriggerHovered = false;
// Recursively hide all child roots
final childRoots = _roots.values.where((r) => r.parentRootId == key).map((r) => r.rootId).toList();
for (final childRoot in childRoots) {
hideRoot(childRoot);
}
_roots.remove(key);
}