debugPaintSize method

  1. @override
void debugPaintSize (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) {
      Size size;
      switch (axis) {
        case Axis.vertical:
          size = Size(child.constraints.crossAxisExtent, child.geometry.layoutExtent);
          break;
        case Axis.horizontal:
          size = Size(child.geometry.layoutExtent, child.constraints.crossAxisExtent);
          break;
      }
      assert(size != null);
      canvas.drawRect(((offset + paintOffsetOf(child)) & size).deflate(0.5), paint);
      child = childAfter(child);
    }
    return true;
  }());
}