Editor class

A staged image editor — a stack of Painter / Exporter layers plus optional gesture and overlay widgets, with a controls strip the host renders in place of its own command bar while editing.

The viewport-fitting matrix (camera) is owned by the host (ComposeEntry) and threaded through painter / layer / gestures via Editor.crop / Editor.draw. Layers don't store or compute their own — same matrix is shared across compose / crop / draw screens.

Mixed-in types
Available extensions

Constructors

Editor({Widget? controls, Widget? gestures, List<Widget>? overlays, ValueListenable<Matrix4>? camera, CustomPainter? painter})
An editor with the given chrome; layers join through add.
Editor.crop({Image? image, CropImageLayer? layer, DrawImageLayer? draw, EntityLayer? entities, required ValueListenable<Matrix4> camera, required AsyncCallback onSubmit, required AsyncCallback onCancel})
Wraps a CropImageLayer with the crop / rotate / flip / aspect-ratio controls. The returned editor's exporter rasterises the cropped + transformed image at CropImageLayer.exportSize.
factory
Editor.draw({Image? image, DrawImageLayer? layer, CropImageLayer? crop, EntityLayer? entities, required ValueListenable<Matrix4> camera, ValueNotifier<Matrix4>? viewerCamera, required ValueListenable<double> chromeHeight, required VoidCallback insertText, required AsyncCallback onSubmit, required AsyncCallback onCancel})
Wraps a DrawImageLayer with the color palette + cancel / undo / submit controls. The exporter composites the source image with all completed strokes.
factory

Properties

camera → ValueListenable<Matrix4>?
Host-owned viewport matrix. Required for image editors; may be null for layer-stack editors that don't paint into a viewport.
final
controls → Widget?
Command strip that the host (e.g. ComposePage) shows in place of the default media commands while editing.
final
disposed → bool
Whether dispose has already run.
no setterinherited
gestures → Widget?
Optional gesture surface stacked on top of the painted layers.
final
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether there is at least one active listener.
no setterinherited
layers → List<Emitter>
Layered scene composing the visible viewport. Layers that mix in Painter paint into the viewport; layers that mix in Exporter also rasterise into the final exported image.
final
overlays → List<Widget>?
Optional overlay widgets — chrome like a brush-size slider that doesn't belong on the gesture surface but should sit above the layers.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

add(Emitter layer, {bool owned = true}) → void
Add layer to the editor. The editor subscribes to its emissions so any layer change repaints / re-emits. Set owned to false when the host retains the layer across tool sessions.
addDispose(VoidCallback callback) → void
Registers a disposal callback. Ignored if already disposed.
inherited
addListener(VoidCallback listener) → void
Register a closure to be called when the object notifies its listeners.
inherited
buildPresenter(BuildContext context) → Widget
Render the editor's viewport — paints all Painter layers plus the optional gestures / overlays on top.
dispose() → void
Releases whatever this object holds. Calling it twice is an error.
override
disposeBy(Dispose disposer) → void

Available on Disposable, provided by the DisposableDisposerExtension extension

Adds this object's dispose to another Dispose collector.
export() → Future<Image>
Rasterise the editor's Exporter layers into a ui.Image. The exported size is the bounding union of every exporter's Exporter.exportSize.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Notifies all registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that the object notifies.
inherited
subscribe(VoidCallback callback) → VoidCallback

Available on Listenable, provided by the ListenableExtension extension

Adds callback as listener and returns a function to remove it.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited