flutter_turtle 0.2.0 copy "flutter_turtle: ^0.2.0" to clipboard
flutter_turtle: ^0.2.0 copied to clipboard

outdated

flutter_turtle is a simple implementation of turtle graphic. It simply uses a custom painter to draw graphics into a widget by a series of Logo-like commands.

flutter_turtle #

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:

Why I Make This? #

It is always fun to make your own DSL!

Example #

screenshot.png

A quick example:

@override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text(widget.title)),
      body: TurtleView(
        child: Container(),
        commands: [
          PenDown(),
          SetColor((_) => Color(0xffff9933)),
          SetStrokeWidth((_) => 2),
          Repeat((_) => 20, [
            Repeat((_) => 180, [
              Forward((_) => 25.0),
              Right((_) => 20),
            ]),
            Right((_) => 18),
          ]),
          PenUp(),
        ],
      ),
    );
  }

Commands #

Currently supported commands are including:

Turtle Motion #

  • PenDown
  • PenUp
  • Left
  • Right
  • Forward
  • Back
  • SetColor
  • SetStrokeWidth
  • GoTo
  • ResetPosition
  • ResetHeading

Flow Control #

  • IfElse
  • Repeat

Macros #

  • SetMacro
  • RunMacro

Misc #

  • Exec
42
likes
0
pub points
53%
popularity

Publisher

verified publisherzonble.net

flutter_turtle is a simple implementation of turtle graphic. It simply uses a custom painter to draw graphics into a widget by a series of Logo-like commands.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_turtle