flutter_fabric library

Flutter Fabric — an interactive canvas library inspired by Fabric.js.

Provides a FabricCanvas widget backed by a FabricController that lets you place, select, move, scale, rotate, and style canvas objects at runtime.

Quick start

final controller = FabricController();

controller.add(FabricRect(
  left: 50, top: 50, width: 120, height: 80,
  fill: Colors.blue,
));

FabricCanvas(controller: controller)

Classes

BaseBrush
Abstract base class for free-drawing brushes.
CircleBrush
A brush that sprays circles of varying sizes.
EraserBrush
A brush that "erases" by painting strokes in the canvas background colour.
FabricBoard
An all-in-one canvas widget with a built-in toolbar and sane defaults.
FabricBoardState
FabricCanvas
Low-level canvas widget. For a batteries-included experience with a built-in toolbar, use FabricBoard instead.
FabricCircle
A circle defined by a radius.
FabricController
FabricEllipse
An ellipse with independent rx and ry radii.
FabricGroup
FabricImage
A canvas object that renders a ui.Image.
FabricIText
FabricLine
A straight line between two points.
FabricMath
A collection of math helpers used throughout flutter_fabric.
FabricObject
FabricObjectFactory
Central deserializer shared by FabricController, FabricSerializer, and FabricGroup.fromJson. Avoids the duplicated switch-statement that previously lived in both the controller and the serializer.
FabricPath
A vector path object, compatible with SVG path d strings.
FabricPolygon
An arbitrary filled/stroked polygon defined by a list of points.
FabricPolyline
FabricRect
A rectangle that can optionally have rounded corners.
FabricSelectionEvent
FabricSerializer
FabricText
A non-editable text label on the canvas.
FabricTextBox
A text object with a fixed bounding width that word-wraps its content.
FabricToolbarStyle
Visual style for the built-in toolbar.
FabricTriangle
An isosceles triangle fitting within its bounding box.
ObjectEditMenu
A rich bottom-sheet editor that adapts its style controls to the object type.
PatternBrush
A brush that stamps a repeating pattern (e.g., circles, stars) along the stroke.
PencilBrush
A smooth pencil-like brush that records pointer positions and converts them to an SVG path (via FabricPath) when the stroke ends.
SelectionOverlay
An overlay widget that renders selection handles around the active FabricObject and translates pointer gestures into move / scale / rotate operations on it.
SprayBrush
A spray-paint brush that scatters random dots around the pointer.
TextEditingOverlay

Enums

FabricImageFit
Fit/alignment modes for FabricImage.
FabricInteractionMode
Defines how the user interacts with FabricCanvas.
FabricTool
Items that can appear in FabricBoard's built-in toolbar.
FabricToolbarPosition
Where the built-in toolbar appears relative to the canvas.

Typedefs

FabricBlendMode = BlendMode
FabricModifiedCallback = void Function(FabricObject object)
FabricObjectCallback = void Function(FabricObject object)
FabricSelectionCallback = void Function(FabricSelectionEvent event)
ImageResolver = Future<Image> Function(String source)