performPaint method
Hook for subclasses to implement actual painting.
Implementation
@override
void performPaint(Buffer buffer, Offset offset) {
if (size.width <= 0 || size.height <= 0) return;
final hasOverflow = _overflowTop > 0 || _overflowBottom > 0;
if (hasOverflow) {
buffer.pushClip(
Rect(offset.dx.toInt(), offset.dy.toInt(), size.width, size.height),
);
}
for (final child in childElements) {
child.paint(buffer, offset + child.relativeOffset);
}
if (_overflowTop > 0 || _overflowBottom > 0) {
final tapeHeight = size.height < 3 ? size.height : 3;
if (_overflowTop > 0) {
final bounds = Rect(
offset.dx.toInt(),
offset.dy.toInt(),
size.width,
tapeHeight,
);
buffer.drawCautionTape(bounds, offset.dx.toInt(), offset.dy.toInt());
}
if (_overflowBottom > 0) {
final bounds = Rect(
offset.dx.toInt(),
(offset.dy + size.height - tapeHeight).toInt(),
size.width,
tapeHeight,
);
buffer.drawCautionTape(bounds, offset.dx.toInt(), bounds.top);
}
}
if (hasOverflow) {
buffer.popClip();
}
}