SignatureController class
class for interaction with signature widget manages points representing signature on canvas provides signature manipulation functions (export, clear)
- Inheritance
-
- Object
- ChangeNotifier
- ValueNotifier<
List< Point> > - SignatureController
Constructors
-
SignatureController.new({List<
Point> ? points, bool disabled = false, Color penColor = Colors.black, StrokeCap strokeCap = StrokeCap.butt, StrokeJoin strokeJoin = StrokeJoin.miter, double penStrokeWidth = 3.0, Color? exportBackgroundColor, Color? exportPenColor, VoidCallback? onDrawStart, VoidCallback? onDrawMove, VoidCallback? onDrawEnd}) - constructor
Properties
- canRedo → bool
-
check if there is any action to redo
no setter
- canUndo → bool
-
check if there is any action to undo
no setter
- defaultHeight → int?
-
Calculates a default height based on existing points.
Will return
null
if there are no points.no setter - defaultWidth → int?
-
Calculates a default width based on existing points.
Will return
null
if there are no points.no setter - disabled ↔ bool
-
If set to true canvas writting will be disabled.
getter/setter pair
- exportBackgroundColor → Color?
-
background color to be used in exported png image
final
- exportPenColor → Color?
-
color of a ginature line to be used in exported png image
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isEmpty → bool
-
check if canvas is empty (opposite of isNotEmpty method for convenience)
no setter
- isNotEmpty → bool
-
check if canvas is not empty (opposite of isEmpty method for convenience)
no setter
- maxXValue → double?
-
The biggest x value for all points.
Will return
null
if there are no points.no setter - maxYValue → double?
-
The biggest y value for all points.
Will return
null
if there are no points.no setter - minXValue → double?
-
The smallest x value for all points.
Will return
null
if there are no points.no setter - minYValue → double?
-
The smallest y value for all points.
Will return
null
if there are no points.no setter - onDrawEnd ↔ VoidCallback?
-
callback to notify when drawing has stopped
getter/setter pair
- onDrawMove ↔ VoidCallback?
-
callback to notify when the pointer was moved while drawing.
getter/setter pair
- onDrawStart ↔ VoidCallback?
-
callback to notify when drawing has started
getter/setter pair
- penColor → Color
-
color of a signature line
final
- penStrokeWidth → double
-
boldness of a signature line
final
-
points
↔ List<
Point> -
getter for points representing signature on 2D canvas
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- strokeCap → StrokeCap
-
shape of line ends
final
- strokeJoin → StrokeJoin
-
shape of line joins
final
-
value
↔ List<
Point> -
The current value stored in this notifier.
getter/setter pairinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
addPoint(
Point point) → void - add point to point collection
-
clear(
) → void - Clear the canvas
-
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
-
pointsToStrokes(
double minDistanceBetweenPoints) → List< List< Point> > - Helper method to convert points to strokes
-
pushCurrentStateToUndoStack(
) → void - REMEMBERS CURRENT CANVAS STATE IN UNDO STACK
-
redo(
) → void -
It will remove last reverted actions and add it into
_latestActions
Then, it will modify the real points with the last reverted action. -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
toImage(
{int? width, int? height}) → Future< Image?> -
Convert to an ui.Image.
Will return
null
if there are no points. -
toPngBytes(
{int? height, int? width}) → Future< Uint8List?> -
convert canvas to dart:ui ui.Image and then to PNG represented in Uint8List
height and width should be at least as big as the drawings size
Will return
null
if there are no points. -
toRawSVG(
{int? width, int? height, double minDistanceBetweenPoints = 3}) → String? -
Export the current content to a raw SVG string.
Will return
null
if there are no points.width
Canvas width to useheight
Canvas height to useminDistanceBetweenPoints
Minimal distance between points to be included in svg. Used to reduce svg output size. -
toString(
) → String -
A string representation of this object.
inherited
-
toSVG(
{int? width, int? height, double minDistanceBetweenPoints = 3}) → SvgPicture? -
Export the current content to a SVG graphic.
Will return
null
if there are no points.width
Canvas width to useheight
Canvas height to useminDistanceBetweenPoints
Minimal distance between points to be included in svg. Used to reduce svg output size. -
undo(
) → void -
It will remove last action from
_latestActions
. The last action will be saved to_revertedActions
that will be used to do redo-ing. Then, it will modify the real points with the last action.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited