getTrimmedLength method

int getTrimmedLength([
  1. int? cols
])
override

Implementation

int getTrimmedLength([int? cols]) {
  if (cols == null) {
    cols = _maxCols;
  }
  for (var i = cols - 1; i >= 0; i--) {
    if (cellGetContent(i) != 0) {
      // we are at the last cell in this line that has content.
      // the length of this line is the index of this cell + 1
      // the only exception is that if that last cell is wider
      // than 1 then we have to add the diff
      final lastCellWidth = cellGetWidth(i);
      return i + lastCellWidth;
    }
  }
  return 0;
}