paint method
Implementation
@override
String paint() {
final child = _child;
String content;
if (child == null) {
content = '';
} else {
final canReuseChild =
_lastChildPaint != null &&
identical(_lastChildPaintTarget, child) &&
_lastChildPaintSize == child.size &&
!child.paintDirty;
if (canReuseChild) {
content = _lastChildPaint!;
} else {
content = child.paint();
_lastChildPaint = content;
_lastChildPaintTarget = child;
_lastChildPaintSize = child.size;
}
}
final widthForPaint = (_resolvedWidth ?? width) ?? size.width.toInt();
final heightForPaint = (_resolvedHeight ?? height) ?? size.height.toInt();
final key = (
content,
padding,
margin,
widthForPaint,
heightForPaint,
background,
foreground,
color,
decoration,
foregroundDecoration,
alignment,
align,
verticalAlign,
);
final cached = _lastPaint;
if (cached != null && _lastPaintKey == key) return cached;
final rendered = _renderContainerContent(
contentStr: content,
padding: padding,
margin: margin,
width: widthForPaint,
height: heightForPaint,
background: background,
foreground: foreground,
color: color,
decoration: decoration,
foregroundDecoration: foregroundDecoration,
alignment: alignment,
align: align,
verticalAlign: verticalAlign,
);
_lastPaint = rendered;
_lastPaintKey = key;
return rendered;
}