DrawingPadController class
Controller class for managing drawing pad state and functionality. Manages various settings (e.g., stroke size, color, tool type) and handles undo/redo actions.
Constructors
-
DrawingPadController.new({bool? usePerfectFreehand, GlobalKey<
State< ? canvasKey, Color? backgroundColor})StatefulWidget> > - Initializes a new instance of the DrawingPadController class.
Properties
- backgroundColor ↔ Color
-
getter/setter pair
- backgroundImage ↔ Image?
-
Sets the background image for the drawing pad.
getter/setter pair
-
backgroundImageListenable
→ ValueNotifier<
Image?> -
final
- canDraw → bool
-
no setter
-
canDrawListenable
→ ValueNotifier<
bool> -
final
- canRedo → bool
-
Indicates whether a redo action is currently possible.
no setter
-
canRedoListenable
→ ValueNotifier<
bool> -
Provides a listenable for tracking redo availability.
This is useful for updating UI elements that depend on redo availability.
no setter
- canUndo → bool
-
Indicates whether an undo action is currently possible.
no setter
-
canvasKey
↔ GlobalKey<
State< StatefulWidget> > -
getter/setter pair
- currentStrokeListenable → CurrentStrokeValueNotifier
-
final
- currentTool ↔ DrawingTool
-
Gets the currently selected drawing tool.
getter/setter pair
-
currentToolListenable
→ ValueNotifier<
DrawingTool> -
final
- eraserSize ↔ double
-
Sets the size of the eraser strokes.
getter/setter pair
-
eraserSizeListenable
→ ValueNotifier<
double> -
final
- fillShape ↔ bool
-
Toggles whether shapes should be filled.
getter/setter pair
-
fillShapeListenable
→ ValueNotifier<
bool> -
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- listenable → Listenable
-
Provides a listenable for tracking changes in the drawing pad.
no setter
- polygonSides ↔ int
-
Sets the number of sides for polygon shapes.
getter/setter pair
-
polygonSidesListenable
→ ValueNotifier<
int> -
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showGrid ↔ bool
-
Toggles the grid visibility on the drawing pad.
getter/setter pair
-
showGridListenable
→ ValueNotifier<
bool> -
final
- stampType ↔ StampType?
-
Sets the current stamp type (e.g., circle, square).
getter/setter pair
-
stampTypeListenable
→ ValueNotifier<
StampType?> -
final
- strokeColor ↔ Color
-
Sets the color for drawing strokes.
getter/setter pair
-
strokeColorListenable
→ ValueNotifier<
Color> -
final
- strokeOpacity ↔ double
-
Sets the opacity level for drawing strokes.
getter/setter pair
-
strokeOpacityListenable
→ ValueNotifier<
double> -
final
- strokeSize ↔ double
-
Sets the size of the drawing strokes.
getter/setter pair
-
strokeSizeListenable
→ ValueNotifier<
double> -
final
- strokesListenable → AllStrokesNotifier
-
final
- undoRedoStack ↔ UndoRedoStack
-
Stack used to manage undo and redo functionality.
latefinal
- usePerfectFreehand ↔ bool
-
Determines whether to use the perfect_freehand package.
getter/setter pair
Methods
-
clearStrokes(
) → void - Erases the stroke that intersects the given point.
-
disableDrawing(
) → void - Disables drawing functionality.
-
dispose(
) → void - Cleans up all notifiers when the controller is disposed.
-
enableDrawing(
) → void - Enables drawing functionality.
-
getDrawingAsBase64(
) → Future< String?> - Returns the current drawing as a base64 string.
-
getDrawingAsBytes(
) → Future< Uint8List?> - Returns the current drawing as a byte array.
-
getDrawingAsMap(
) → List< Map< String, dynamic> > - Returns the current drawing as a list of maps.
-
getIntersectedStrokes(
Offset point) → List< Stroke> - Retrieves the strokes that intersect a given point on the drawing pad.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
redo(
) → void - Redoes the last undone action in the drawing pad, if possible.
-
removeBackgroundImage(
) → void - Removes the current background image from the drawing pad.
-
renderFromJson(
String json) → void -
toggleFillShape(
) → void - Toggles whether shapes should be filled.
-
toString(
) → String -
A string representation of this object.
inherited
-
undo(
) → void - Undoes the last action in the drawing pad, if possible.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited