calculateColumns method

List<FxGridColumn> calculateColumns(
  1. int totalColumns,
  2. List<FxGridColumn> visibleChildren
)

Calculates the columns to be rendered in the grid based on the total number of columns and the visible children.

The totalColumns parameter represents the total number of columns in the grid. The visibleChildren parameter is a list of FxGridColumn widgets that should be visible. Returns a list of FxGridColumn widgets representing the calculated columns.

Implementation

List<FxGridColumn> calculateColumns(
  int totalColumns,
  List<FxGridColumn> visibleChildren,
) {
  final List<FxGridColumn> columns = <FxGridColumn>[];

  for (int i = 0; i < totalColumns; i++) {
    final FxGridColumn column = visibleChildren[i % visibleChildren.length];
    columns.add(column);
  }

  return columns;
}