maxIntrinsicWidth method

  1. @override
double maxIntrinsicWidth(
  1. Iterable<RenderBox> cells,
  2. double containerWidth
)
override

The ideal width that the column should have. This must be equal to or greater than the minIntrinsicWidth. The column might be bigger than this width, e.g. if the column is flexible or if the table's width ends up being forced to be bigger than the sum of all the maxIntrinsicWidth values.

The cells argument is an iterable that provides all the cells in the table for this column. Walking the cells is by definition O(N), so algorithms that do that should be considered expensive.

The containerWidth argument is the maxWidth of the incoming constraints for the table, and might be infinite.

Implementation

@override
double maxIntrinsicWidth(Iterable<RenderBox> cells, double containerWidth) {
  double width = 50;
  for (var each in cells) {
    each.layout(const BoxConstraints(), parentUsesSize: true);
    width = max(width, each.size.width);
  }
  return min(containerWidth, width);
}