Skip to content
Paint various shapes on canvas with Flutter CustomPainter
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
lib
test
.gitignore
.metadata
CHANGELOG.md
LICENSE
README.md
analysis_options.yaml
flutter_shapes.iml
heart.gif
pubspec.lock
pubspec.yaml
rotate.gif
screenshot.png
star.gif

README.md

FlutterShapes

Shape types

Adding FlutterShapes to your project

dependencies:
  flutter:
    sdk: flutter
  flutter_shapes:

Drawing a Shape

import 'package:flutter_shapes/flutter_shapes.dart';

class MyPainter extends CustomPainter {
  @override
  void paint(Canvas canvas, Size size) {
    Paint paint = Paint()..color = Colors.black;
    Shapes shapes = Shapes(canvas: canvas, radius: 50, paint: paint, center: Offset.zero, angle: 0);

    shapes.drawCircle();                 // method name
    shapes.drawType(ShapeTypes.Circle);  // enum
    shapes.draw('Circle');               // string
  }
}

Acknowledgements

https://proandroiddev.com/flutter-animation-creating-mediums-clap-animation-in-flutter-3168f047421e

A great article about animation with Flutter.
It helped me to write example codes.

You can’t perform that action at this time.