create method

  1. @override
Layout create(
  1. LayoutDimensions layoutDimensions,
  2. List<Widget> children
)
override

Implementation

@override
Layout create(
  LayoutDimensions layoutDimensions,
  List<Widget> children,
) {
  var cellAlignment = RowAlignment.left;
  RowHeight rowHeight = const RowHeightHighestCell();
  List<LayoutRow> rows = [];
  var row = LayoutRow(
    totalColumns: layoutDimensions.numberOfColumns,
    rowAlignment: cellAlignment,
    rowHeightMode: rowHeight,
  );
  rows.add(row);

  for (var cell in _cells(children)) {
    if (_startOnNewRow(cell, row)) {
      if (cell.position is CellPositionNextRow) {
        var nextRow = (cell.position as CellPositionNextRow);
        cellAlignment = nextRow.rowAlignment;
        rowHeight = nextRow.rowHeight;
      }
      row = LayoutRow(
        totalColumns: layoutDimensions.numberOfColumns,
        rowAlignment: cellAlignment,
        rowHeightMode: rowHeight,
      );
      rows.add(row);
    }
    row.add(cell);
  }

  return _rowsToLayout(layoutDimensions, rows);
}