fitHeight method

int fitHeight()

Computes the total height needed to fit all children based on direction and childGap.

Implementation

int fitHeight() {
  if (children.isEmpty) return 0;
  int requiredHeight = 0;

  if (direction == Axis.vertical) {
    requiredHeight += ((children.length - 1) * childGap);
  }

  for (var child in children) {
    if (direction == Axis.vertical) {
      requiredHeight += child.fitHeight();
    } else {
      requiredHeight = max(requiredHeight, child.fitHeight());
    }
  }

  return requiredHeight + 10;
}