Creates a table.
The children
, defaultColumnWidth, and defaultVerticalAlignment
arguments must not be null.
Source
Table({ Key key, List<TableRow> children: const <TableRow>[], this.columnWidths, this.defaultColumnWidth: const FlexColumnWidth(1.0), this.border, this.defaultVerticalAlignment: TableCellVerticalAlignment.top, this.textBaseline }) : children = children, _rowDecorations = children.any((TableRow row) => row.decoration != null) ? children.map/*<Decoration>*/((TableRow row) => row.decoration).toList(growable: false) : null, super(key: key) { assert(children != null); assert(defaultColumnWidth != null); assert(defaultVerticalAlignment != null); assert(() { if (children.any((TableRow row) => row.children.any((Widget cell) => cell == null))) { throw new FlutterError( 'One of the children of one of the rows of the table was null.\n' 'The children of a TableRow must not be null.' ); } return true; }); assert(() { List<Widget> flatChildren = children.expand((TableRow row) => row.children).toList(growable: false); if (debugChildrenHaveDuplicateKeys(this, flatChildren)) { throw new FlutterError( 'Two or more cells in this Table contain widgets with the same key.\n' 'Every widget child of every TableRow in a Table must have different keys. The cells of a Table are ' 'flattened out for processing, so separate cells cannot have duplicate keys even if they are in ' 'different rows.' ); } return true; }); assert(() { if (children.any((TableRow row1) => row1.key != null && children.any((TableRow row2) => row1 != row2 && row1.key == row2.key))) { throw new FlutterError( 'Two or more TableRow children of this Table had the same key.\n' 'All the keyed TableRow children of a Table must have different Keys.' ); } return true; }); assert(() { if (children.isNotEmpty) { final int cellCount = children.first.children.length; if (children.any((TableRow row) => row.children.length != cellCount)) { throw new FlutterError( 'Table contains irregular row lengths.\n' 'Every TableRow in a Table must have the same number of children, so that every cell is filled. ' 'Otherwise, the table will contain holes.' ); } } return true; }); }