ScribbleState class sealed

Represents the state of the scribble widget.

Implementers
Annotations
  • @freezed

Constructors

ScribbleState.drawing({required Sketch sketch, SketchLine? activeLine, @Default(ScribblePointerMode.all) ScribblePointerMode allowedPointersMode, @Default([]) List<int> activePointerIds, Point? pointerPosition, @Default(0xFF000000) int selectedColor, @Default(5) double selectedWidth, @Default(1) double scaleFactor, @Default(0) double simplificationTolerance})
The state of the scribble widget when it is being drawn on.
const
factory
ScribbleState.erasing({required Sketch sketch, @Default(ScribblePointerMode.all) ScribblePointerMode allowedPointersMode, @Default([]) List<int> activePointerIds, Point? pointerPosition, @Default(5) double selectedWidth, @Default(1) double scaleFactor, @Default(0) double simplificationTolerance})
The state of the scribble widget when the user is currently erasing.
const
factory
ScribbleState.fromJson(Map<String, dynamic> json)
Constructs a ScribbleState from a JSON object.
factory

Properties

active bool
Returns whether the widget is currently active, meaning that only one pointer is interacting with the widget.
no setter
activePointerIds List<int>
The ids of all supported pointers that are currently interacting with the widget.
no setterinherited
allowedPointersMode ScribblePointerMode
Which pointers are allowed for drawing and will be captured by the scribble widget.
no setterinherited
copyWith → $ScribbleStateCopyWith<ScribbleState>
Create a copy of ScribbleState with the given fields replaced by the non-null parameter values.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
lines List<SketchLine>
Returns the list of lines that should be drawn on the canvas by combining the sketches lines with the current active line if it exists.
no setter
pointerPosition Point?
The current position of the pointer
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scaleFactor double
How much the widget is scaled at the moment.
no setterinherited
selectedWidth double
The current width of the pen
no setterinherited
simplificationTolerance double
The current tolerance of simplification, in pixels.
no setterinherited
sketch Sketch
The current state of the sketch
no setterinherited
supportedPointerKinds Set<PointerDeviceKind>
Returns a set of PointerDeviceKind that represents the currently supported devices, depending on ScribbleState.allowedPointersMode.
no setter

Methods

map<TResult extends Object?>({required TResult drawing(Drawing value), required TResult erasing(Erasing value)}) → TResult
inherited
mapOrNull<TResult extends Object?>({TResult? drawing(Drawing value)?, TResult? erasing(Erasing value)?}) → TResult?
inherited
maybeMap<TResult extends Object?>({TResult drawing(Drawing value)?, TResult erasing(Erasing value)?, required TResult orElse()}) → TResult
inherited
maybeWhen<TResult extends Object?>({TResult drawing(Sketch sketch, SketchLine? activeLine, ScribblePointerMode allowedPointersMode, List<int> activePointerIds, Point? pointerPosition, int selectedColor, double selectedWidth, double scaleFactor, double simplificationTolerance)?, TResult erasing(Sketch sketch, ScribblePointerMode allowedPointersMode, List<int> activePointerIds, Point? pointerPosition, double selectedWidth, double scaleFactor, double simplificationTolerance)?, required TResult orElse()}) → TResult
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Serializes this ScribbleState to a JSON map.
inherited
toString() String
A string representation of this object.
inherited
when<TResult extends Object?>({required TResult drawing(Sketch sketch, SketchLine? activeLine, ScribblePointerMode allowedPointersMode, List<int> activePointerIds, Point? pointerPosition, int selectedColor, double selectedWidth, double scaleFactor, double simplificationTolerance), required TResult erasing(Sketch sketch, ScribblePointerMode allowedPointersMode, List<int> activePointerIds, Point? pointerPosition, double selectedWidth, double scaleFactor, double simplificationTolerance)}) → TResult
inherited
whenOrNull<TResult extends Object?>({TResult? drawing(Sketch sketch, SketchLine? activeLine, ScribblePointerMode allowedPointersMode, List<int> activePointerIds, Point? pointerPosition, int selectedColor, double selectedWidth, double scaleFactor, double simplificationTolerance)?, TResult? erasing(Sketch sketch, ScribblePointerMode allowedPointersMode, List<int> activePointerIds, Point? pointerPosition, double selectedWidth, double scaleFactor, double simplificationTolerance)?}) → TResult?
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited