debugPaint method
- PaintingContext context,
- Offset offset
override
Override this method to paint debugging information.
Implementation
@override
void debugPaint(PaintingContext context, Offset offset) {
assert(() {
if (debugPaintSizeEnabled) {
final double strokeWidth = math.min(4.0, geometry!.paintExtent / 30.0);
final Paint paint = Paint()
..color = const Color(0xFF33CC33)
..strokeWidth = strokeWidth
..style = PaintingStyle.stroke
..maskFilter = MaskFilter.blur(BlurStyle.solid, strokeWidth);
final double arrowExtent = geometry!.paintExtent;
final double padding = math.max(2.0, strokeWidth);
final Canvas canvas = context.canvas;
canvas.drawCircle(
offset.translate(padding, padding),
padding * 0.5,
paint,
);
switch (constraints.axis) {
case Axis.vertical:
canvas.drawLine(
offset,
offset.translate(constraints.crossAxisExtent, 0.0),
paint,
);
_debugDrawArrow(
canvas,
paint,
offset.translate(constraints.crossAxisExtent * 1.0 / 4.0, padding),
offset.translate(constraints.crossAxisExtent * 1.0 / 4.0, arrowExtent - padding),
constraints.normalizedGrowthDirection,
);
_debugDrawArrow(
canvas,
paint,
offset.translate(constraints.crossAxisExtent * 3.0 / 4.0, padding),
offset.translate(constraints.crossAxisExtent * 3.0 / 4.0, arrowExtent - padding),
constraints.normalizedGrowthDirection,
);
case Axis.horizontal:
canvas.drawLine(
offset,
offset.translate(0.0, constraints.crossAxisExtent),
paint,
);
_debugDrawArrow(
canvas,
paint,
offset.translate(padding, constraints.crossAxisExtent * 1.0 / 4.0),
offset.translate(arrowExtent - padding, constraints.crossAxisExtent * 1.0 / 4.0),
constraints.normalizedGrowthDirection,
);
_debugDrawArrow(
canvas,
paint,
offset.translate(padding, constraints.crossAxisExtent * 3.0 / 4.0),
offset.translate(arrowExtent - padding, constraints.crossAxisExtent * 3.0 / 4.0),
constraints.normalizedGrowthDirection,
);
}
}
return true;
}());
}