rough_flutter library

A Flutter implementation of the rough.js library for creating sketchy, hand-drawn-like graphics.

This library provides tools to create graphics that appear to be drawn by hand, with various customization options for roughness, fill styles, and drawing parameters.

Basic Usage

import 'package:rough_flutter/rough_flutter.dart';

// Create a rough canvas
final roughCanvas = Rough.canvas(canvas);

// Draw a rough rectangle
roughCanvas.rectangle(10, 10, 100, 80);

// Draw with custom configuration
final config = DrawConfig.build(
  roughness: 2.0,
  bowing: 1.5,
);
final filler = HachureFiller();
final generator = Generator(config, filler);

final drawable = generator.circle(50, 50, 40);
canvas.drawRough(drawable, paint, fillPaint);

Main Components

  • DrawConfig: Configuration for drawing parameters
  • Generator: Creates drawable objects for various shapes
  • Filler: Defines fill patterns (hachure, solid, zigzag, etc.)
  • RoughBoxDecoration: Flutter decoration for rough-styled containers

Classes

CrossHatchFiller
DashedFiller
DotDashFiller
DotFiller
Drawable
DrawConfig
Configuration for how shapes are drawn with a rough/sketchy style.
Filler
FillerConfig
Generator
Generator is class that lets you create a Drawable object for a shape.
HachureFiller
HatchFiller
IntersectionInfo
Line
NoFiller
Op
OpSet
PointD
Randomizer
A wrapper around Random that provides controlled random number generation with the ability to reset to a known seed.
RoughBoxDecoration
RoughDecorationPainter
RoughDrawingStyle
RoughMobileHaptics
Haptic feedback helper for mobile web
RoughMobileLayout
Mobile web responsive layout helper
RoughMobilePerformance
Performance monitoring for mobile web
RoughMobileSlider
Touch-optimized slider for mobile web
RoughMobileWeb
Mobile web optimizations for flutter_rough
RoughMobileWebPainter
Mobile web aware custom painter
RoughWebUtils
Web-specific rough canvas utilities
SolidFiller
ZigZagFiller

Enums

FillingStyle
FillStyle
OpSetType
OpType
RoughBoxShape
The shape to use when rendering a RoughBoxDecoration.

Extensions

Rough on Canvas
This is the base Rough class for painting
RoughWebOptimized on Canvas
Web-optimized version of the Rough canvas extension