setSizeIfNeeded method

void setSizeIfNeeded(
  1. BoxConstraints constraints
)

Implementation

void setSizeIfNeeded(BoxConstraints constraints) {
  final max = _info.isHorizontalSeparator ? constraints.maxHeight : constraints.maxWidth;
  var isMaxSizeChanged = maxSize == null || maxSize! != max;
  if (!isMaxSizeChanged || children.isEmpty) {
    return;
  }

  maxSize = max;
  final remain = maxSizeWithoutSeparators!;

  for (var c in children) {
    if (c.widget is Separator) {
      c.percentage = 0;
      c.size = _info.separatorSize;
    } else {
      c.size = remain * c.percentage!;
      c.defaultPercentage = c.percentage;
    }
  }
}