TurtleGraphicsPainter class
TurtleGraphicsPainter is a CustomPainter. It helps in drawing some fractal art to create some romantic UI for your awesome applications. It's based on Turtle Graphic, Wikipedia.
- Inheritance
-
- Object
- Listenable
- CustomPainter
- TurtleGraphicsPainter
- Available Extensions
Constructors
- TurtleGraphicsPainter({required dynamic onDrawing(TurtleGraphicsPainter painter, Canvas canvas, Size size)})
- onDrawing draw your own art.
Properties
- currentAngle → dynamic
-
Get current angle.
no setter
- currentPoint → dynamic
-
Get current point.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- onDrawing → dynamic Function(TurtleGraphicsPainter painter, Canvas canvas, Size size)
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticsBuilder → SemanticsBuilderCallback?
-
Returns a function that builds semantic information for the picture drawn
by this painter.
no setterinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be notified when it is time to repaint.
inherited
-
backward(
double distance) → void -
Move the currentPoint to a point that backward a
distance
by the currentAngle. -
drawLineBackward(
Canvas canvas, Paint paint, double distance) → void -
Draw a line that backward a
distance
by the currentAngle, and then move the currentPoint to the end of line. -
drawLineForward(
Canvas canvas, Paint paint, double distance) → void -
Draw a line that forward a
distance
by the currentAngle, and then move the currentPoint to the end of line. -
drawLineTo(
Canvas canvas, Paint paint, double x, double y) → void -
Draw a line from the currentPoint to a point
x
,y
by currentcanvas
and a single or dynamicpaint
. -
drawPoint(
Canvas canvas, Paint paint, Offset p, double size) → void -
Draw a point with your
size
by currentcanvas
and a single or dynamicpaint
.p
is the point to draw. -
drawRelativeLineTo(
Canvas canvas, Paint paint, double dx, double dy) → void -
Draw a line from the currentPoint to a point that translated
dx
,dy
from the currentPoint by currentcanvas
and a single or dynamicpaint
. -
forward(
double distance) → void -
Move the currentPoint to a point that forward a
distance
by the currentAngle. -
hitTest(
Offset position) → bool? -
Called whenever a hit test is being performed on an object that is using
this custom paint delegate.
inherited
-
moveTo(
double x, double y) → void -
Move the currentPoint to a point
x
,y
-
moveToPoint(
Offset p) → void -
Move the currentPoint to
p
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
paint(
Canvas canvas, Size size) → void -
Called whenever the object needs to paint. The given Canvas has its
coordinate space configured such that the origin is at the top left of the
box. The area of the box is the size of the
size
argument.override -
pointTo(
double x, double y) → void -
Point currentPoint to a point
x
,y
without saving. Then remember to call resetTemporaryPoint after using. -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that the
object notifies when it is time to repaint.
inherited
-
resetTemporaryPoint(
) → void - Reset the currentPoint to the true current point before pointTo.
-
setAngle(
double angle) → void -
Set an
angle
in degree. Why do I use degree? because it's easy to read and understand, it helps you make art easier. -
shouldRebuildSemantics(
covariant CustomPainter oldDelegate) → bool -
Called whenever a new instance of the custom painter delegate class is
provided to the RenderCustomPaint object, or any time that a new
CustomPaint object is created with a new instance of the custom painter
delegate class (which amounts to the same thing, because the latter is
implemented in terms of the former).
inherited
-
shouldRepaint(
covariant TurtleGraphicsPainter oldDelegate) → bool -
Called whenever a new instance of the custom painter delegate class is
provided to the RenderCustomPaint object, or any time that a new
CustomPaint object is created with a new instance of the custom painter
delegate class (which amounts to the same thing, because the latter is
implemented in terms of the former).
override
-
toString(
) → String -
A string representation of this object.
inherited
-
turnLeft(
double alpha) → void -
Turn the currentAngle left/anticlockwise an
angle
in degree. -
turnRight(
double angle) → void -
Turn the currentAngle right/clockwise an
angle
in degree.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited