handleTap method

  1. @override
void handleTap(
  1. RowColumnIndex rowColumnIndex
)
override

Processes the selection operation when tap a cell.

Implementation

@override
void handleTap(RowColumnIndex rowColumnIndex) {
  final DataGridConfiguration dataGridConfiguration =
      _dataGridStateDetails!();
  _pressedRowColumnIndex = rowColumnIndex;
  if (dataGridConfiguration.selectionMode == SelectionMode.none) {
    return;
  }
  final int recordIndex = grid_helper.resolveToRecordIndex(
      dataGridConfiguration, rowColumnIndex.rowIndex);

  final RowColumnIndex previousRowColumnIndex = RowColumnIndex(
      dataGridConfiguration.currentCell.rowIndex,
      dataGridConfiguration.currentCell.columnIndex);
  if (!dataGridConfiguration.currentCell
      ._handlePointerOperation(dataGridConfiguration, rowColumnIndex)) {
    return;
  }
  if (!dataGridConfiguration.isShiftKeyPressed) {
    _pressedRowIndex = recordIndex;
    _shiftSelectedRows.clear();
    _processSelection(
        dataGridConfiguration, rowColumnIndex, previousRowColumnIndex);
  }

  if (dataGridConfiguration.isShiftKeyPressed &&
      dataGridConfiguration.selectionMode == SelectionMode.multiple &&
      _selectedRows.contains(selection_helper.getRecord(
          dataGridConfiguration, _pressedRowIndex))) {
    _processShiftKeySelection(rowColumnIndex, recordIndex);
  }
}