PaintingController class

The PaintingController class is responsible for managing and controlling the painting state.

Inheritance

Constructors

PaintingController({required double strokeWidth, required Color color, required PaintModeE mode, required bool fill, required int strokeMultiplier, required double opacity})
Creates an instance of the PaintingController with initial settings.

Properties

activePaintings → List<PaintedModel>
Returns the list of painted models representing the painting history.
no setter
busy → bool
Indicates whether there is an ongoing painting action.
no setter
canRedo → bool
Determines whether redo actions can be performed on the current state.
no setter
canUndo → bool
Determines whether undo actions can be performed on the current state.
no setter
color → Color
Returns the current color used for painting.
no setter
end → Offset?
Returns the ending point of a painting action.
no setter
fill → bool
Indicates whether the current mode requires filling (e.g., circle or rectangle).
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
historyPosition ↔ int
The current position in the painting history.
getter/setter pair
mode → PaintModeE
Returns the current painting mode (e.g., line, circle, rectangle).
no setter
offsets → List<Offset?>
Returns the list of recorded painting offsets.
no setter
opacity ↔ double
The opacity for the drawing
getter/setter pair
paintedModel → PaintedModel
Getter for the current state of the painted model.
no setter
paintHistory → List<List<PaintedModel>>
History of painted models representing previous painting operations.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scaledStrokeWidth → double
Returns the scaled stroke width based on the stroke multiplier.
no setter
start → Offset?
Returns the starting point of a painting action.
no setter
strokeWidth → double
Returns the current stroke width.
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
addOffsets(Offset offset) → void
Adds an offset to the list of offsets and notifies listeners.
addPaintInfo(PaintedModel paintInfo) → void
Adds a painted model to the painting history and notifies listeners of the change.
dispose() → void
Discards any resources used by the object.
inherited
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 painting action by moving it from the redo history to the history and notifies listeners.
removeLayers(List<String> idList) → void
Adds a painted model to the painting history and notifies listeners of the change.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
reset() → void
Resets the starting and ending points and clears the offsets list, then notifies listeners.
setColor(Color color) → void
Sets the painting color to the specified color and notifies listeners.
setEnd(Offset offset) → void
Sets the ending point of a painting action and notifies listeners.
setFill(bool fill) → void
Sets whether the current mode should fill the shape and notifies listeners.
setInProgress(bool val) → void
Sets the painting progress state and notifies listeners.
setMode(PaintModeE mode) → void
Sets the painting mode to the specified mode and notifies listeners.
setOpacity(double value) → void
Sets the current level of opacity.
setStart(Offset offset) → void
Sets the starting point of a painting action and notifies listeners.
setStrokeMultiplier(int value) → void
Sets the stroke multiplier to the specified value and notifies listeners.
setStrokeWidth(double val) → void
Sets the stroke width to the specified value and notifies listeners.
toString() → String
A string representation of this object.
inherited
undo() → void
Undoes the last painting action by moving it from the history to the redo history and notifies listeners.

Operators

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