handleTap method
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;
}
final bool isShiftPressed = dataGridConfiguration.isShiftKeyPressed;
// Issue:
// Header checkbox selection causes shift selection to fail.
//
// Fix:
// After header checkbox selection, the pressed rowIndex is set to -1.
// To fix this, when performing shift or normal selection, if rowIndex is -1,
// set it to the currently tapped rowIndex.
if (_pressedRowIndex < 0 || !isShiftPressed) {
_pressedRowIndex = recordIndex;
}
// Issue:
// FLUT-920028-The HeaderCheckboxState changes when tapping on the header checkbox and normal rows, while setting onSelectionChanging to false and onCurrentCellActivating to true, with the selection mode set to multiple.
// We resolved the issue by verifying that onSelectionChanging is set to false
if (!isShiftPressed && _raiseSelectionChanging()) {
_shiftSelectedRows.clear();
_processSelection(
dataGridConfiguration,
rowColumnIndex,
previousRowColumnIndex,
);
} else if (dataGridConfiguration.selectionMode == SelectionMode.multiple) {
_processShiftKeySelection(rowColumnIndex, recordIndex);
}
}