moveCurrentCellTo method

void moveCurrentCellTo(
  1. RowColumnIndex rowColumnIndex
)

Moves the current-cell to the specified cell coordinates.

Implementation

void moveCurrentCellTo(RowColumnIndex rowColumnIndex) {
  if (_dataGridStateDetails != null) {
    final DataGridConfiguration dataGridConfiguration =
        _dataGridStateDetails!();
    if (rowColumnIndex != RowColumnIndex(-1, -1) &&
        dataGridConfiguration.selectionMode != SelectionMode.none &&
        dataGridConfiguration.navigationMode != GridNavigationMode.row) {
      final int rowIndex = grid_helper.resolveToRowIndex(
          dataGridConfiguration, rowColumnIndex.rowIndex);
      final int columnIndex = grid_helper.resolveToGridVisibleColumnIndex(
          dataGridConfiguration, rowColumnIndex.columnIndex);
      // Ignore the scrolling when the row index or column index are in negative
      // or invalid.
      if (rowIndex.isNegative || columnIndex.isNegative) {
        return;
      }
      final SelectionManagerBase rowSelectionController =
          dataGridConfiguration.rowSelectionManager;
      if (rowSelectionController is RowSelectionManager) {
        selection_manager.processSelectionAndCurrentCell(
            dataGridConfiguration, RowColumnIndex(rowIndex, columnIndex),
            isProgrammatic: true);
      }
    }
  }
}