updateDimensions method
Updates the screen buffer dimensions to accommodate the new size.
If the new dimensions are larger than current, expands the buffer and fills new areas with empty cells. Smaller dimensions are ignored to prevent data loss.
width
: New minimum width for the buffer
height
: New minimum height for the buffer
Implementation
void updateDimensions(int width, int height) {
if (this.width == width && this.height == height) return;
this.width = max(width, this.width);
this.height = max(height, this.height);
_screenBuffer = List.generate(
this.height,
(_) => List.filled(this.width, BufferCell(char: ' ')),
);
_previousFrame = List.generate(
this.height,
(_) => List.filled(this.width, BufferCell(char: '')),
);
}