debugPaintPadding function

void debugPaintPadding(
  1. Canvas canvas,
  2. Rect outerRect,
  3. Rect? innerRect, {
  4. double outlineWidth = 2.0,
})

Paint a diagram showing the given area as padding.

The innerRect argument represents the position of the child, if any.

When innerRect is null, the method draws the entire outerRect in a grayish color representing spacing.

When innerRect is non-null, the method draws the padding region around the innerRect in a tealish color, with a solid outline around the inner region.

This method is used by RenderPadding.debugPaintSize when debugPaintSizeEnabled is true.

Implementation

void debugPaintPadding(
  Canvas canvas,
  Rect outerRect,
  Rect? innerRect, {
  double outlineWidth = 2.0,
}) {
  assert(() {
    if (innerRect != null && !innerRect.isEmpty) {
      _debugDrawDoubleRect(canvas, outerRect, innerRect, const Color(0x900090FF));
      _debugDrawDoubleRect(
        canvas,
        innerRect.inflate(outlineWidth).intersect(outerRect),
        innerRect,
        const Color(0xFF0090FF),
      );
    } else {
      final Paint paint = Paint()..color = const Color(0x90909090);
      canvas.drawRect(outerRect, paint);
    }
    return true;
  }());
}