diff --git a/packages/flutter/lib/src/rendering/table.dart b/packages/flutter/lib/src/rendering/table.dart index 6193f7b437..cb2a586570 100644 --- a/packages/flutter/lib/src/rendering/table.dart +++ b/packages/flutter/lib/src/rendering/table.dart @@ -891,13 +891,15 @@ class RenderTable extends RenderBox { for (int y = 0; y < rows; y += 1) { if (_rowDecorations.length <= y) break; - _rowDecorationPainters[y] ??= _rowDecorations[y].createBoxPainter(); - _rowDecorationPainters[y].paint(canvas, new Rect.fromLTRB( - offset.dx, - offset.dy + _rowTops[y], - offset.dx + size.width, - offset.dy + _rowTops[y+1] - )); + if (_rowDecorations[y] != null) { + _rowDecorationPainters[y] ??= _rowDecorations[y].createBoxPainter(); + _rowDecorationPainters[y].paint(canvas, new Rect.fromLTRB( + offset.dx, + offset.dy + _rowTops[y], + offset.dx + size.width, + offset.dy + _rowTops[y+1] + )); + } } } for (int index = 0; index < _children.length; index += 1) { diff --git a/packages/flutter/lib/src/widgets/table.dart b/packages/flutter/lib/src/widgets/table.dart index b2f72651fd..15bbf20d68 100644 --- a/packages/flutter/lib/src/widgets/table.dart +++ b/packages/flutter/lib/src/widgets/table.dart @@ -47,7 +47,9 @@ class Table extends RenderObjectWidget { this.defaultVerticalAlignment: TableCellVerticalAlignment.top, this.textBaseline }) : children = children, - _rowDecorations = children.map/**/((TableRow row) => row.decoration).toList(), + _rowDecorations = children.any((TableRow row) => row.decoration != null) + ? children.map/**/((TableRow row) => row.decoration).toList() + : null, super(key: key) { assert(children != null); assert(defaultColumnWidth != null);