fillRect method
void
fillRect(})
Fills a rectangular region with the given character and attributes.
Implementation
void fillRect(
Rect rect, {
String? char,
int? fg,
int? bg,
int? modifiers,
int? underlineColor,
String? uri,
bool? blend,
}) {
final clipped = _clipStack.isEmpty ? rect : activeClip.intersect(rect);
if (clipped.width <= 0 || clipped.height <= 0) return;
final startX = max(0, clipped.left);
final startY = max(0, clipped.top);
final endX = min(width, clipped.right);
final endY = min(height, clipped.bottom);
if (startX >= endX || startY >= endY) return;
if (char != null) {
for (var y = startY; y < endY; y++) {
final rowOffset = y * width;
_clearSplitWideEdges(rowOffset, startX, endX, char);
characters.fillRange(rowOffset + startX, rowOffset + endX, char);
}
}
if (fg == null &&
bg == null &&
modifiers == null &&
underlineColor == null &&
uri == null) {
return;
}
final useBlend = blend ?? defaultBlend;
for (var y = startY; y < endY; y++) {
final rowOffset = y * width;
for (var x = startX; x < endX; x++) {
_writeCellAttributes(
(rowOffset + x) * 3,
fg: fg,
bg: bg,
modifiers: modifiers,
underlineColor: underlineColor,
uri: uri,
blend: useBlend,
);
}
}
}