restorePartialExpansion method

void restorePartialExpansion()

Reverse the effect of applyPartialExpansion.

Moves partial children back from children to hiddenChildren.

Implementation

void restorePartialExpansion() {
  if (isPartiallyExpanded) {
    final toHide = <LayoutNode>[];
    children.removeWhere((child) {
      if (partialChildIds!.contains(child.id)) {
        toHide.add(child);
        return true;
      }
      return false;
    });
    hiddenChildren ??= [];
    hiddenChildren!.addAll(toHide);
  }

  // Recurse into all children
  for (final child in children) {
    child.restorePartialExpansion();
  }
  if (hiddenChildren != null) {
    for (final child in hiddenChildren!) {
      child.restorePartialExpansion();
    }
  }
}