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);
  BaselineOffset minBaseline = BaselineOffset.noBaseline;
  ChildType? child = firstChild;
  while (child != null) {
    final ParentDataType childParentData = child.parentData! as ParentDataType;
    final BaselineOffset candidate = BaselineOffset(child.getDistanceToActualBaseline(baseline)) + childParentData.offset.dy;
    minBaseline = minBaseline.minOf(candidate);
    child = childParentData.nextSibling;
  }
  return minBaseline.offset;
}