defaultComputeDistanceToHighestActualBaseline method

double? defaultComputeDistanceToHighestActualBaseline(
  1. TextBaseline baseline
)

Returns the minimum baseline value among every child.

Useful when the vertical position of the children isn't determined by the order in the child list.

Implementation

double? defaultComputeDistanceToHighestActualBaseline(TextBaseline baseline) {
  assert(!debugNeedsLayout);
  double? result;
  ChildType? child = firstChild;
  while (child != null) {
    final ParentDataType childParentData = child.parentData as ParentDataType;
    // ignore: INVALID_USE_OF_PROTECTED_MEMBER
    double? candidate = child.getDistanceToActualBaseline(baseline);
    if (candidate != null) {
      candidate += childParentData.offset.dy;
      if (result != null)
        result = math.min(result, candidate);
      else
        result = candidate;
    }
    child = childParentData.nextSibling;
  }
  return result;
}