PaintingController class

The PaintingController class is responsible for managing and controlling the painting state in a Flutter application.

Inheritance

Constructors

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

Properties

brush Paint
Returns a Paint object configured with the current color, stroke width, and fill settings.
no setter
busy bool
Indicates whether there is an ongoing painting action.
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
mode PaintModeE
Returns the current painting mode (e.g., line, circle, rectangle).
no setter
needFill bool
Indicates whether the current mode requires filling (e.g., circle or rectangle).
no setter
offsets List<Offset?>
Returns the list of recorded painting offsets.
no setter
paintHistory List<PaintedModel>
Returns the list of painted models representing the painting history.
no setter
paintRedoHistory List<PaintedModel>
Returns the list of painted models representing the redo history.
no setter
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.
clear() → void
Clears the painting history and notifies listeners.
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
init({double? strokeWidth, Color? color, PaintModeE? mode}) → void
Initializes the painting settings with optional parameters and notifies listeners.
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.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
resetStartAndEnd() → 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.
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