PainterController class
Controller used to control a FlutterPainter widget.
- IMPORTANT: * Each FlutterPainter should have its own controller.
- Inheritance
-
- Object
- ChangeNotifier
- ValueNotifier<
PainterControllerValue> - PainterController
- Available extensions
Constructors
-
PainterController({PainterSettings settings = const PainterSettings(), List<
Drawable> ? drawables = const [], BackgroundDrawable? background}) - Create a PainterController.
- PainterController.fromValue(PainterControllerValue value)
- Create a PainterController from a PainterControllerValue.
Properties
- background ← BackgroundDrawable?
-
Setting this will notify all the listeners of this PainterController
that they need to update (it calls notifyListeners). For this reason,
this value should only be set between frames, e.g. in response to user
actions, not during the build, layout, or paint phases.
no getter
- background ↔ BackgroundDrawable?
-
Available on PainterController, provided by the PainterControllerHelper extension
The current background drawable directly fromvalue
.getter/setter pair - canRedo → bool
-
Whether a redo operation can be performed or not.
no setter
- canUndo → bool
-
Whether an undo operation can be performed or not.
no setter
-
drawables
→ List<
Drawable> -
Available on PainterController, provided by the PainterControllerHelper extension
The unmodifiable list of drawables directly fromvalue
.no setter - drawShapeOnce ↔ bool
-
Available on PainterController, provided by the PainterControllerHelper extension
Whether to draw shapes once or continuously fromvalue.settings.shape
directly.getter/setter pair - enlargeObjectControlsResolver ↔ ObjectEnlargeControlsResolver
-
Available on PainterController, provided by the PainterControllerHelper extension
The function used to decide whether to enlarge the object controls or not fromvalue.settings.object
directly.getter/setter pair -
events
→ Stream<
PainterEvent> -
The stream of
PainterEvent
s dispatched from this controller.no setter - freeStyleColor ↔ Color
-
Available on PainterController, provided by the PainterControllerHelper extension
The color used for free-style drawing fromvalue.settings.freeStyle
directly.getter/setter pair - freeStyleMode ↔ FreeStyleMode
-
Available on PainterController, provided by the PainterControllerHelper extension
The free-style painting mode fromvalue.settings.freeStyle
directly.getter/setter pair - freeStyleSettings ↔ FreeStyleSettings
-
Available on PainterController, provided by the PainterControllerHelper extension
The free-style settings directly from the painter settings.getter/setter pair - freeStyleStrokeWidth ↔ double
-
Available on PainterController, provided by the PainterControllerHelper extension
The stroke width used for free-style drawing fromvalue.settings.freeStyle
directly.getter/setter pair - hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- maxScale ↔ double
-
Available on PainterController, provided by the PainterControllerHelper extension
The maximum scale that the user can "zoom in" to fromvalue.settings.scale
directly.getter/setter pair - minScale ↔ double
-
Available on PainterController, provided by the PainterControllerHelper extension
The minimum scale that the user can "zoom out" to fromvalue.settings.scale
directly.getter/setter pair - objectLayoutAssist ↔ ObjectLayoutAssistSettings
-
Available on PainterController, provided by the PainterControllerHelper extension
The layout-assist settings of the selected object drawable fromvalue.settings.object
directly.getter/setter pair - objectSettings ↔ ObjectSettings
-
Available on PainterController, provided by the PainterControllerHelper extension
The object settings directly from the painter settings.getter/setter pair -
painterKey
→ GlobalKey<
State< StatefulWidget> > -
This key will be used by the FlutterPainter widget assigned this controller.
final
-
performedActions
↔ Queue<
ControllerAction> -
Queues used to track the actions performed on drawables in the controller.
This is used to undo and redo actions.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scaleSettings ↔ ScaleSettings
-
Available on PainterController, provided by the PainterControllerHelper extension
The scale settings directly from the painter settings.getter/setter pair - scalingEnabled ↔ bool
-
Available on PainterController, provided by the PainterControllerHelper extension
Whether scaling is enabled or not fromvalue.settings.scale
directly.getter/setter pair - selectedObjectDrawable → ObjectDrawable?
-
The currently selected object drawable.
no setter
- settings ↔ PainterSettings
-
Available on PainterController, provided by the PainterControllerHelper extension
The current painter settings directly fromvalue
.getter/setter pair -
shapeFactory
↔ ShapeFactory<
ShapeDrawable> ? -
Available on PainterController, provided by the PainterControllerHelper extension
The factory for the shape to be drawn fromvalue.settings.shape
directly.getter/setter pair - shapePaint ↔ Paint?
-
Available on PainterController, provided by the PainterControllerHelper extension
The paint used to draw shapes fromvalue.settings.shape
directly.getter/setter pair - shapeSettings ↔ ShapeSettings
-
Available on PainterController, provided by the PainterControllerHelper extension
The shape settings directly from the painter settings.getter/setter pair - showObjectScaleRotationControlsResolver ↔ ObjectShowScaleRotationControlsResolver
-
Available on PainterController, provided by the PainterControllerHelper extension
The function used to decide whether to show scale and rotation object controls or not fromvalue.settings.object
directly.getter/setter pair - textFocusNode ↔ FocusNode?
-
Available on PainterController, provided by the PainterControllerHelper extension
The focus node used to edit text drawables text fromvalue.settings.text
directly.getter/setter pair - textSettings ↔ TextSettings
-
Available on PainterController, provided by the PainterControllerHelper extension
The text settings directly from the painter settings.getter/setter pair - textStyle ↔ TextStyle
-
Available on PainterController, provided by the PainterControllerHelper extension
The text style to be used for text drawables fromvalue.settings.text
directly.getter/setter pair - transformationController → TransformationController
-
This controller will be used by the InteractiveViewer in FlutterPainter to notify
children widgets of transformation changes.
final
-
unperformedActions
↔ Queue<
ControllerAction> -
Queues used to track the actions performed on drawables in the controller.
This is used to undo and redo actions.
getter/setter pair
- value ↔ PainterControllerValue
-
The current value stored in this notifier.
getter/setter pairinherited
Methods
-
addDrawables(
Iterable< Drawable> drawables, {bool newAction = true}) → void -
Add the
drawables
to the controller value drawables. -
addImage(
Image image, [Size? size]) → void - Adds an ImageDrawable to the center of the painter.
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
addText(
) → void -
Dispatches a
AddTextPainterEvent
onevents
stream. -
clearDrawables(
{bool newAction = true}) → void - Removes all drawables from the controller value.
-
deselectObjectDrawable(
{bool isRemoved = false}) → void - Deselects the object drawable from the drawables.
-
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
-
groupDrawables(
{bool newAction = true}) → void - Groups all drawables in the controller into one drawable.
-
insertDrawables(
int index, Iterable< Drawable> drawables, {bool newAction = true}) → void -
Inserts the
drawables
to the controller value drawables at the providedindex
. -
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. The redo operation can be undone.
-
removeDrawable(
Drawable drawable, {bool newAction = true}) → bool -
Removes the first occurrence of
drawable
from the controller value. -
removeLastDrawable(
{bool newAction = true}) → void - Removes the last drawable from the controller value.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
renderImage(
Size size) → Future< Image> - Renders the background and all other drawables to a ui.Image object.
-
replaceDrawable(
Drawable oldDrawable, Drawable newDrawable, {bool newAction = true}) → bool -
Replace
oldDrawable
withnewDrawable
in the controller value. -
selectObjectDrawable(
ObjectDrawable? drawable) → void - Selects an object drawable from the list of drawables.
-
toString(
) → String -
A string representation of this object.
inherited
-
undo(
) → void - Undoes the last action performed on drawables. The action can later be redone.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
of(
BuildContext context) → PainterController -
Uses the
PainterControllerWidget
inherited widget to fetch the PainterController instance in this context. This is used internally in the library to fetch the controller at different widgets.