defaultComputeDistanceToFirstActualBaseline method

double? defaultComputeDistanceToFirstActualBaseline(
  1. LayoutTextBaseline baseline
)

Computes the distance to the first child's baseline.

Returns the baseline offset of the first child that has a baseline. This is used for vertical layouts where the baseline of the container is defined by its first child.

Returns null if no child has a baseline.

Implementation

double? defaultComputeDistanceToFirstActualBaseline(
  LayoutTextBaseline baseline,
) {
  Box? child = firstChild;
  while (child != null) {
    final childParentData = child.parentData;
    final double? result = child.getDistanceToBaseline(baseline);
    if (result != null) {
      return result + childParentData.offset.dy;
    }
    child = childParentData.nextSibling;
  }
  return null;
}