getIntrinsicWidth method

  1. @override
int getIntrinsicWidth(
  1. int height
)
override

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

Implementation

@override
int getIntrinsicWidth(int height) {
  if (width case final w? when w < BoxConstraints.infinity) return w;
  if (child case final c?) {
    final childHeight = switch (this.height) {
      final h? when h < BoxConstraints.infinity => h,
      _ => height,
    };
    return c.getIntrinsicWidth(childHeight);
  }
  return 0;
}