@@ -421,7 +421,15 @@ class _TableRenderObject extends RenderBox
421421 if (width != null ) {
422422 drySizes.add (Size (width, .0 ));
423423 } else {
424- drySizes.add (_performLayoutDry (child, const BoxConstraints ()));
424+ var drySize =
425+ Size (constraints.hasBoundedWidth ? constraints.maxWidth : 100.0 , 0 );
426+ try {
427+ drySize = _performLayoutDry (child, const BoxConstraints ());
428+ } catch (dryLayoutError, stackTrace) {
429+ debugPrint ('Ignored _performLayoutDry error: '
430+ '$dryLayoutError \n $stackTrace ' );
431+ }
432+ drySizes.add (drySize);
425433 }
426434
427435 columnCount = max (columnCount, data.columnStart + data.columnSpan);
@@ -477,13 +485,23 @@ class _TableRenderObject extends RenderBox
477485 }
478486
479487 if (columnWidthSmallerThanDry) {
480- // this call is expensive, we try to avoid it as much as possible
481- final minWidth = child.getMinIntrinsicWidth (double .infinity);
482- final minColumnWidth = (minWidth - columnGaps) / data.columnSpan;
488+ double ? minWidth;
489+ try {
490+ // this call is expensive, we try to avoid it as much as possible
491+ // width being smaller than dry size means the table is too crowded
492+ // calculating min to avoid breaking line in the middle of a word
493+ minWidth = child.getMinIntrinsicWidth (double .infinity);
494+ } catch (minWidthError, stackTrace) {
495+ debugPrint ('Ignored getMinIntrinsicWidth error: '
496+ '$minWidthError \n $stackTrace ' );
497+ }
483498
484- for (var c = 0 ; c < data.columnSpan; c++ ) {
485- final column = data.columnStart + c;
486- columnWidths[column] = max (columnWidths[column], minColumnWidth);
499+ if (minWidth != null ) {
500+ final minColumnWidth = (minWidth - columnGaps) / data.columnSpan;
501+ for (var c = 0 ; c < data.columnSpan; c++ ) {
502+ final column = data.columnStart + c;
503+ columnWidths[column] = max (columnWidths[column], minColumnWidth);
504+ }
487505 }
488506 }
489507 }
0 commit comments