pasteCellValue method
Paste based on current cell
Implementation
@override
void pasteCellValue(List<List<String>> textList) {
if (currentCellPosition == null) {
return;
}
if (selectingMode.isRow && currentSelectingRows.isNotEmpty) {
_pasteCellValueIntoSelectingRows(textList: textList);
} else {
int? columnStartIdx;
int columnEndIdx;
int? rowStartIdx;
int rowEndIdx;
if (currentSelectingPosition == null) {
// No cell selection : Paste in order based on the current cell
columnStartIdx = currentCellPosition!.columnIdx;
columnEndIdx =
currentCellPosition!.columnIdx! + textList.first.length - 1;
rowStartIdx = currentCellPosition!.rowIdx;
rowEndIdx = currentCellPosition!.rowIdx! + textList.length - 1;
} else {
// If there are selected cells : Paste in order from selected cell range
columnStartIdx = min(currentCellPosition!.columnIdx!,
currentSelectingPosition!.columnIdx!);
columnEndIdx = max(currentCellPosition!.columnIdx!,
currentSelectingPosition!.columnIdx!);
rowStartIdx = min(
currentCellPosition!.rowIdx!, currentSelectingPosition!.rowIdx!);
rowEndIdx = max(
currentCellPosition!.rowIdx!, currentSelectingPosition!.rowIdx!);
}
_pasteCellValueInOrder(
textList: textList,
rowIdxList: [for (var i = rowStartIdx!; i <= rowEndIdx; i += 1) i],
columnStartIdx: columnStartIdx,
columnEndIdx: columnEndIdx,
);
}
notifyListeners(true, pasteCellValue.hashCode);
}