DrawingController class
A controller that manages drawing, text boxes, undo/redo, and page-specific actions for a multi-page PDF or canvas editor.
- Inheritance
-
- Object
- ChangeNotifier
- DrawingController
Constructors
Properties
- getCurrentColor → Color
-
Returns the current selected color.
no setter
-
getHistory
→ List<
PaintContent> -
Returns the list of drawing history for the current page.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
-
painterKey
→ GlobalKey<
State< StatefulWidget> > -
Global key for accessing the repaint boundary for image capturing.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
adjustPages(
int pageIndex, {bool isAdd = true}) → Future< void> - Adjusts page indexes after adding or removing a page.
-
clear(
) → void - Clears all drawings, text boxes, and undo stack for the current page.
-
clearAllPages(
) → void - Clears all drawings, text boxes, and undo stacks for all pages.
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
drawing(
Offset nowPaint) → void - Updates the current drawing stroke with a new point.
-
endDraw(
) → void - Ends the current drawing action.
-
getAllDrawings(
) → Map< int, List< PaintContent> > - Returns all drawings across all pages.
-
getAllTextBoxes(
) → Map< int, List< TextBox> > - Returns all text boxes mapped by page index.
-
getImageData(
int page) → Future< ByteData?> - Captures the current canvas as an image and returns it as ByteData.
-
getTextBoxes(
) → List< TextBox> - Returns the list of text boxes for the current page.
-
hasClearContent(
) → bool - Checks if there is any content to clear (drawings, text, undo stack).
-
hasContent(
{bool isRedo = false}) → bool - Checks if there is content to undo or redo.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
redo(
) → void - Redoes the last undone action.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
setColor(
Color color) → void - Sets a new drawing color.
-
setPage(
int page) → void - Sets the active page and initializes data structures if needed.
-
startDraw(
Offset startPoint) → void -
Starts a new drawing stroke at the given
startPoint
. -
toString(
) → String -
A string representation of this object.
inherited
-
undo(
) → void - Undoes the last drawing or action.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited