GridPad constructor

GridPad({
  1. Key? key,
  2. required GridPadCells gridPadCells,
  3. required List<Widget> children,
  4. GridPadPlacementPolicy placementPolicy = GridPadPlacementPolicy.defaultPolicy,
})

Implementation

GridPad({
  Key? key,
  required this.gridPadCells,
  required List<Widget> children,
  this.placementPolicy = GridPadPlacementPolicy.defaultPolicy,
})  : _placementStrategy = GridPlacementStrategy(
        gridPadCells,
        placementPolicy,
      ),
      super(key: key) {
  for (var contentCell in children) {
    final Cell cell;
    if (contentCell is Cell) {
      cell = contentCell;
    } else {
      cell = Cell.implicit(child: contentCell);
    }
    if (cell._implicitly) {
      _placementStrategy.placeImplicitly(
        rowSpan: cell.rowSpan,
        columnSpan: cell.columnSpan,
        content: cell.child,
      );
    } else {
      _placementStrategy.placeExplicitly(
        row: cell.row,
        column: cell.column,
        rowSpan: cell.rowSpan,
        columnSpan: cell.columnSpan,
        content: cell.child,
      );
    }
  }
  _content.addAll(_placementStrategy.content);
}