drawing_engine library

Industrial Drawing Engine

A modular, CustomPainter-based drawing engine for Flutter.

Features

  • 14 shape types (freehand, line, arrow, rectangle, circle, triangle, star, polygon, dimension, text, L/T/U/box shapes)
  • Select, move, resize, rotate, duplicate, flip, delete shapes
  • Eraser tool with configurable radius
  • Measurement tool with distance readout
  • Shape recognition from freehand strokes
  • Smart snapping to other shapes
  • Bounded undo/redo with configurable max depth
  • JSON serialization/deserialization
  • PNG export with configurable pixel ratio
  • Fully customizable: no dependency on flutter_colorpicker or any specific dialog/UI library

Quick Start

import 'package:industrial_drawing_flutter/drawing_engine.dart';

final controller = DrawingController(
  config: DrawingConfig(maxUndoSteps: 100),
);

// In your widget tree:
DrawingCanvas(controller: controller, canvasKey: GlobalKey())

Classes

CanvasControls
Floating canvas controls for zoom, view reset, grid toggle, and snapping. Uses a modern premium glassmorphism design.
DrawingCanvas
The core interactive drawing surface.
DrawingConfig
Configuration for the drawing engine.
DrawingController
The core controller for the drawing engine.
DrawingHeader
Top header bar with title, undo/redo, save, share, and clear actions. Designed as a floating glassmorphic pill.
DrawingPainter
Custom painter that renders all shapes, grid, selection indicators, measurement lines, and previews on the canvas.
DrawingToolbar
Modern bottom toolbar with tool selection and shape palette. Designed as a premium floating glass pill.
DrawnShape
Represents a single drawn shape on the canvas.
PropertyPanel
Side property panel with contextual controls. Premium, dark glassmorphism design.
ShapeRecognizer
Recognizes freehand strokes as geometric shapes.
SnapHelper
Snap logic for aligning shapes to each other and grids.

Enums

DrawMode
Drawing modes for shapes.
InteractionMode
Interaction modes when a shape is selected.
ResizeHandle
Resize handles on a selected shape's bounding box.
ShapeType
Shape types available in the drawing engine.
Tool
Available tools in the drawing engine.