CanvasWrapper class

Proxies Canvas functions

We wrapped the canvas here, because we needed to write tests for our drawing system. Now in tests we can verify that these functions called with a specific value.

Constructors

CanvasWrapper(Canvas canvas, Size size)

Properties

canvas Canvas
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size Size
final

Methods

clipPath(Path path, {bool doAntiAlias = true}) → void
Directly calls Canvas.clipPath
clipRect(Rect rect, {ClipOp clipOp = ClipOp.intersect, bool doAntiAlias = true}) → void
Directly calls Canvas.clipRect
drawArc(Rect rect, double startAngle, double sweepAngle, bool useCenter, Paint paint) → void
Directly calls Canvas.drawCircle
drawCircle(Offset center, double radius, Paint paint) → void
Directly calls Canvas.drawCircle
drawDashedLine(Offset from, Offset to, Paint painter, List<int>? dashArray) → void
Draws a dashed line from passed in offsets
drawDot(FlDotPainter painter, AFlSpot spot, Offset offset) → void
Paints a dot using customized FlDotPainter
drawImage(Image image, Offset offset, Paint paint) → void
Directly calls Canvas.drawImage
drawLine(Offset p1, Offset p2, Paint paint) → void
Directly calls Canvas.drawLine
drawPath(Path path, Paint paint) → void
Directly calls Canvas.drawPath
drawPicture(Picture picture) → void
Directly calls Canvas.drawPicture
drawRect(Rect rect, Paint paint) → void
Directly calls Canvas.drawRect
drawRotated({required Size size, Offset rotationOffset = Offset.zero, Offset drawOffset = Offset.zero, required double angle, required DrawCallback drawCallback}) → void
Handles performing multiple draw actions rotated.
drawRRect(RRect rrect, Paint paint) → void
Directly calls Canvas.drawRRect
drawText(TextPainter tp, Offset offset, [double? rotateAngle]) → void
Paints a text on the Canvas
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
restore() → void
Directly calls Canvas.restore
rotate(double radius) → void
Directly calls Canvas.rotate
save() → void
Directly calls Canvas.save
saveLayer(Rect bounds, Paint paint) → void
Directly calls Canvas.saveLayer
toString() String
A string representation of this object.
inherited
translate(double dx, double dy) → void
Directly calls Canvas.translate

Operators

operator ==(Object other) bool
The equality operator.
inherited