flutter_turtle library
flutter_turtle is a simple implementation of turtle graphics for Flutter. It simply uses a custom painter to draw graphics by a series of Logo-like commands.
For further information about turtle graphics, please visit Wikipedia:
- https://en.wikipedia.org/wiki/Turtle_graphics
- https://en.wikipedia.org/wiki/Logo_(programming_language)
Currently supported commands are including:
Turtle Motion
- PenDown
- PenUp
- Left
- Right
- Forward
- Back
- SetColor
- SetStrokeWidth
- GoTo
- ResetPosition
- ResetHeading
- Label
- SetLabelHeight
Flow Control
- If
- IfElse
- Repeat
Macros
- SetMacro
- RunMacro
Classes
- AnimatedTurtleView
- A widget takes commands and draw Turtle Graphics with animations.
- Back
- Asks the turtle to move backward.
- ControllableTurtleView
- A widget that draws Turtle Graphics and you can specify its progress by a given controller.
- Forward
- Asks the turtle to move forward.
- GoTo
- Moves the turtle to an absolute position.
- If
- Represents if..else flow control.
- IfElse
- Represents if..else flow control.
-
Instruction<
T> - An abstract interface for all commands.
- Label
- Draws texts.
- Left
- Asks the turtle to turn left with the given degrees.
- Log
- Stops the current running macro.
- Macro
- Represents macros.
- PenDown
- Puts the pen down.
- PenUp
- Raises the pen up.
- Repeat
- Asks the turtle to run a series of commands repeatedly.
- ResetHeading
- Makes the turtle to face to top.
- ResetPosition
- Moves the turtle to center.
- Right
- Asks the turtle to right with the given degrees.
- RunMacro
- Runs a macro by a given name.
- SetColor
- Sets a new color for drawing lines and texts.
- SetLabelHeight
- Sets the height of the labels.
- SetMacro
- Sets a macro.
- SetStrokeWidth
- Sets a new stroke width.
- Stop
- Stops the current running macro.
- TurtleCommand
- An abstract interface for all commands.
- TurtleCompiler
- Compiles a list of TurtleCommand to a list of Instruction.
- TurtleState
- Represents the state of a turtle.
- TurtleView
- A widget takes commands and draw Turtle Graphics in a canvas accordingly.