moveCurrentCell method

  1. @override
void moveCurrentCell(
  1. PlutoMoveDirection direction, {
  2. bool force = false,
  3. bool notify = true,
})
inherited

Change the current cell to the cell in the direction and move the scroll force true : Allow left and right movement with tab key in editing state.

Implementation

@override
void moveCurrentCell(
  PlutoMoveDirection direction, {
  bool force = false,
  bool notify = true,
}) {
  if (currentCell == null) return;

  // @formatter:off
  if (!force && isEditing && direction.horizontal) {
    // Select type column can be moved left or right even in edit state
    if (currentColumn?.type.isSelect == true) {
    }
    // Date type column can be moved left or right even in edit state
    else if (currentColumn?.type.isDate == true) {
    }
    // Time type column can be moved left or right even in edit state
    else if (currentColumn?.type.isTime == true) {
    }
    // Currency type column can be moved left or right even in edit state
    else if (currentColumn?.type.isCurrency == true) {
    }
    // Read only type column can be moved left or right even in edit state
    else if (currentColumn?.readOnly == true) {
    }
    // Unable to move left and right in other modified states
    else {
      return;
    }
  }
  // @formatter:on

  final cellPosition = currentCellPosition;

  if (cellPosition != null && canNotMoveCell(cellPosition, direction)) {
    eventManager!.addEvent(
      PlutoGridCannotMoveCurrentCellEvent(
        cellPosition: cellPosition,
        direction: direction,
      ),
    );

    return;
  }

  final toMove = cellPositionToMove(
    cellPosition,
    direction,
  );

  setCurrentCell(
    refRows[toMove.rowIdx!].cells[refColumns[toMove.columnIdx!].field],
    toMove.rowIdx,
    notify: notify,
  );

  if (direction.horizontal) {
    moveScrollByColumn(direction, cellPosition!.columnIdx);
  } else if (direction.vertical) {
    moveScrollByRow(direction, cellPosition!.rowIdx);
  }
  return;
}