debugPaint method Null safety

  1. @override
void debugPaint(
  1. PaintingContext context,
  2. Offset offset
)
override

Override this method to paint debugging information.

Implementation

@override
void debugPaint(PaintingContext context, Offset offset) {
  assert(() {
    if (debugPaintSizeEnabled) {
      final Paint paint = Paint()
        ..color = const Color(0xFFCC9933)
        ..strokeWidth = 3.0
        ..style = PaintingStyle.stroke;
      Offset start, end, delta;
      switch (constraints.axis) {
        case Axis.vertical:
          final double x = offset.dx + constraints.crossAxisExtent / 2.0;
          start = Offset(x, offset.dy);
          end = Offset(x, offset.dy + geometry!.paintExtent);
          delta = Offset(constraints.crossAxisExtent / 5.0, 0.0);
          break;
        case Axis.horizontal:
          final double y = offset.dy + constraints.crossAxisExtent / 2.0;
          start = Offset(offset.dx, y);
          end = Offset(offset.dy + geometry!.paintExtent, y);
          delta = Offset(0.0, constraints.crossAxisExtent / 5.0);
          break;
      }
      for (int index = -2; index <= 2; index += 1) {
        paintZigZag(
          context.canvas,
          paint,
          start - delta * index.toDouble(),
          end - delta * index.toDouble(),
          10,
          10.0,
        );
      }
    }
    return true;
  }());
}