rough 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 65

Pub GitHub Release Date GitHub

Rough #

Rough is a library that allows you draw in a sketchy, hand-drawn-like style. It's a direct port of Rough.js.

Installation #

In the dependencies: section of your pubspec.yaml, add the following line:

  rough: <latest_version>

Basic usage #

Right now only drawing via canvas is supported. This is a basic documentation in case you want to play around with Rough. I can't ensure non-breaking changes of the library interface.

To draw a figure you have to:

  1. Create a DrawConfig object to determine how your drawing will look.
  2. Create a Filler to be used when drawing objects (you have to provide a configuration for the filling and a DrawConfig for the filling path).
  3. Create a Generator object using the created DrawConfig and Filler. This will define a drawing/filling style.
  4. Invoke the drawing method from the Generator to create a Drawable.
  5. Paint the Drawable in the canvas using the drawRough method extension for Canvas.

Here an example on how to draw a circle:

//Create a `DrawConfig` object.
DrawConfig myDrawConfig =
  roughness: 3,
  curveStepCount: 14,
  maxRandomnessOffset: 3,

//Create a `Filler` with a configuration (we reuse the drawConfig in this case).
FillerConfig myFillerConfig = FillerConfig(
    hachureGap: 8,
    hachureAngle: -20,
    drawConfig: myDrawConfig,
Filler myFiller = ZigZagFiller(myFillerConfig);

//Create a `Generator` with the created `DrawConfig` and `Filler`
Generator generator = Generator(

//4. Build a circle `Drawable`.
Drawable figure =, 200, 320);

//5. Paint the `Drawable` in the canvas.
Canvas.drawRough(figure, pathPaint, fillPaint);

And this is the result:


Both DrawConfig and FillerConfig will use default values for anything not specified.

Samples #

Some screenshots of the example app:

Example 1 Example 2 Example 3 Example 4

[0.1.1] - 2020-May-5. #

  • FillConfig no has a builder
  • Rough.draw is now drawRough, a extension method of ``Draw
  • Basic external api documentation

[0.1.0+2] - 2020-May-5. #

  • Basic documentation
  • Cute badges!

[0.1.0+1] - 2020-May-5. #

  • Testing publication through CI

[0.1.0] - 2020-May-4. #

  • Initial release
  • support for basic figures with some fillings.


import 'package:RoughExample/pages/home.dart';
import 'package:flutter/material.dart';

void main() => runApp(FlutterRoughDemo());

class FlutterRoughDemo extends StatelessWidget {
  // This widget is the root of your application.
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Rough Demo',
      theme: ThemeData(
      home: HomePage(),

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  rough: ^0.1.1

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:rough/rough.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jul 10, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart


  • rough that is a package requiring null.

Health suggestions

Fix lib/src/core.dart. (-0.50 points)

Analysis of lib/src/core.dart reported 1 hint:

line 10 col 6: The declaration '_' isn't referenced.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies