getIntrinsicHeight method

  1. @override
int getIntrinsicHeight(
  1. int width
)
override

Computes the intrinsic height of this widget under the given width constraint.

Implementation

@override
int getIntrinsicHeight(int width) {
  if (children.isEmpty) return 0;
  final constraints = children
      .map((c) => _getConstraint(c, LayoutDirection.horizontal))
      .toList();
  final rects = splitRect(
    Rect(0, 0, width, 1),
    constraints,
    LayoutDirection.horizontal,
  );
  var maxH = 0;
  for (var i = 0; i < children.length; i++) {
    final h = children[i].getIntrinsicHeight(rects[i].width);
    if (h > maxH) maxH = h;
  }
  return maxH;
}