debugPaintSize method
- PaintingContext context,
- Offset offset
override
In debug mode, paints a border around this render box.
Called for every RenderBox when debugPaintSizeEnabled is true.
Implementation
@override
void debugPaintSize(PaintingContext context, Offset offset) {
assert(() {
super.debugPaintSize(context, offset);
final Paint paint = Paint()
..style = PaintingStyle.stroke
..strokeWidth = 1.0
..color = const Color(0xFF00FF00);
final Canvas canvas = context.canvas;
RenderSliver? child = firstChild;
while (child != null) {
final Size size = switch (axis) {
Axis.vertical => Size(child.constraints.crossAxisExtent, child.geometry!.layoutExtent),
Axis.horizontal => Size(child.geometry!.layoutExtent, child.constraints.crossAxisExtent),
};
canvas.drawRect(((offset + paintOffsetOf(child)) & size).deflate(0.5), paint);
child = childAfter(child);
}
return true;
}());
}