PaintController class
The PaintController
class is responsible for managing and controlling
the paint state.
- Inheritance
-
- Object
- ChangeNotifier
- PaintController
Constructors
- PaintController({required double strokeWidth, required Color color, required PaintModeE mode, required bool fill, required int strokeMultiplier, required double opacity})
-
Creates an instance of the
PaintController
with initial settings.
Properties
-
activePaintItemList
→ List<
PaintedModel> -
Returns the list of painted models representing the paint history.
no setter
- busy → bool
-
Indicates whether there is an ongoing paint 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 paint.
no setter
- end → Offset?
-
Returns the ending point of a paint 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 paint history.
getter/setter pair
- mode → PaintModeE
-
Returns the current paint mode (e.g., line, circle, rectangle).
no setter
-
offsets
→ List<
Offset?> -
Returns the list of recorded paint 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 paint 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 paint 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 paint history and notifies listeners of the change.
-
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
-
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 paint 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 paint 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 paint color to the specified color and notifies listeners.
-
setEnd(
Offset offset) → void - Sets the ending point of a paint 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 paint progress state and notifies listeners.
-
setMode(
PaintModeE mode) → void - Sets the paint 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 paint 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 paint action by moving it from the history to the redo history and notifies listeners.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited