Handle tables that don't have decorations.

This commit is contained in:
Ian Hickson 2016-04-04 17:10:31 -07:00
parent 19e624ccfe
commit 70053fff07
2 changed files with 12 additions and 8 deletions

View File

@ -891,6 +891,7 @@ class RenderTable extends RenderBox {
for (int y = 0; y < rows; y += 1) {
if (_rowDecorations.length <= y)
break;
if (_rowDecorations[y] != null) {
_rowDecorationPainters[y] ??= _rowDecorations[y].createBoxPainter();
_rowDecorationPainters[y].paint(canvas, new Rect.fromLTRB(
offset.dx,
@ -900,6 +901,7 @@ class RenderTable extends RenderBox {
));
}
}
}
for (int index = 0; index < _children.length; index += 1) {
RenderBox child = _children[index];
if (child != null) {

View File

@ -47,7 +47,9 @@ class Table extends RenderObjectWidget {
this.defaultVerticalAlignment: TableCellVerticalAlignment.top,
this.textBaseline
}) : children = children,
_rowDecorations = children.map/*<Decoration>*/((TableRow row) => row.decoration).toList(),
_rowDecorations = children.any((TableRow row) => row.decoration != null)
? children.map/*<Decoration>*/((TableRow row) => row.decoration).toList()
: null,
super(key: key) {
assert(children != null);
assert(defaultColumnWidth != null);