defaultComputeDistanceToFirstActualBaseline method

double? defaultComputeDistanceToFirstActualBaseline(
  1. TextBaseline baseline
)

Returns the baseline of the first child with a baseline.

Useful when the children are displayed vertically in the same order they appear in the child list.

Implementation

double? defaultComputeDistanceToFirstActualBaseline(TextBaseline baseline) {
  assert(!debugNeedsLayout);
  ChildType? child = firstChild;
  while (child != null) {
    final ParentDataType childParentData = child.parentData! as ParentDataType;
    final double? result = child.getDistanceToActualBaseline(baseline);
    if (result != null) {
      return result + childParentData.offset.dy;
    }
    child = childParentData.nextSibling;
  }
  return null;
}