buildDataCells method

List<DataCell> buildDataCells(
  1. T item,
  2. bool isSelected
)

Implementation

List<DataCell> buildDataCells(T item, bool isSelected) {
  final cells = <DataCell>[];

  final rows = item.rows;
  for (var index = 0; index < rows.length; index++) {
    final row = rows[index];
    final customCell = widget.cellBuilder?.call(item, index, row);

    if (customCell != null) {
      cells.add(DataCell(customCell));
      continue;
    }

    if (row is Widget) {
      cells.add(DataCell(row));
      continue;
    }

    cells.add(
      DataCell(
        MyText(
          row.toString(),
          textColor: isSelected ? ConectarDesignSystem.settings.primaryColor : Colors.black,
        ),
        onTap: widget.onTap == null ? null : () => widget.onTap?.call(item),
      ),
    );
  }

  if (widget.actions.isNotEmpty) {
    cells.add(buildActionsCell(item));
  }

  return cells;
}