moveSelection method

void moveSelection(
  1. int dr,
  2. int dc
)

Implementation

void moveSelection(int dr, int dc) {
  var r = _sel.row + dr;
  var c = _sel.col + dc;
  if (c < 0) {
    c = colCount - 1;
    r -= 1;
  }
  if (c >= colCount) {
    c = 0;
    r += 1;
  }
  r = r.clamp(0, rowCount - 1);
  c = c.clamp(0, colCount - 1);
  final next = CellRef(r, c);
  if (next == _sel) return;
  _sel = next;
  notifyListeners();
}