public _TheatreElement(RenderObjectWidget widget) : base(widget) { D.assert(!WidgetsD.debugChildrenHaveDuplicateKeys(widget, ((_Theatre)widget).offstage)); }
public Table( Key key = null, List <TableRow> children = null, Dictionary <int, TableColumnWidth> columnWidths = null, TableColumnWidth defaultColumnWidth = null, TableBorder border = null, TableCellVerticalAlignment defaultVerticalAlignment = TableCellVerticalAlignment.top, TextBaseline?textBaseline = null ) : base(key: key) { children = children ?? new List <TableRow>(); defaultColumnWidth = defaultColumnWidth ?? new FlexColumnWidth(1.0f); this.children = children; this.columnWidths = columnWidths; this.defaultColumnWidth = defaultColumnWidth; this.border = border; this.defaultVerticalAlignment = defaultVerticalAlignment; this.textBaseline = textBaseline; D.assert(() => { if (children.Any((TableRow row) => { return(row.children.Any((Widget cell) => { return cell == null; })); })) { throw new UIWidgetsError( "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); }); D.assert(() => { if (children.Any((TableRow row1) => { return(row1.key != null && children.Any((TableRow row2) => { return row1 != row2 && row1.key == row2.key; })); })) { throw new UIWidgetsError( "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); }); D.assert(() => { if (children.isNotEmpty()) { int cellCount = this.children.First().children.Count; if (children.Any((TableRow row) => { return(row.children.Count != cellCount); })) { throw new UIWidgetsError( "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); }); _rowDecorations = null; if (children.Any((TableRow row) => { return(row.decoration != null); })) { _rowDecorations = new List <Decoration>(); foreach (TableRow row in children) { _rowDecorations.Add(row.decoration); } } D.assert(() => { List <Widget> flatChildren = new List <Widget>(); foreach (TableRow row in children) { flatChildren.AddRange(row.children); } if (WidgetsD.debugChildrenHaveDuplicateKeys(this, flatChildren)) { throw new UIWidgetsError( "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); }); }