DrawingAddingPreview<T extends InteractableDrawing<DrawingToolConfig>> class abstract

A preview of a drawing that is being added to the InteractiveLayer.

This class serves as a temporary visual representation during the drawing tool creation process. It's responsible for:

  1. Displaying a preview of the drawing being created
  2. Showing alignment guides, hints, or other visual aids
  3. Handling user interactions during the drawing creation process
  4. Coordinating with the InteractiveLayerBehaviour to manage platform-specific interactions (mobile vs desktop)

The preview exists only during the drawing addition lifecycle and is removed once the drawing is fully created and added to the chart. Different drawing tools will implement their own specific preview behaviors by extending this class.

See also:

Implemented types
Implementers

Constructors

DrawingAddingPreview({required InteractiveLayerBehaviour interactiveLayerBehaviour, required T interactableDrawing, required dynamic onAddingStateChange(AddingStateInfo)})
Initializes the DrawingAddingPreview.

Properties

canStartDragFromEmpty → bool
Whether this preview can start a drag gesture even when nothing has been placed yet, i.e. before hitTest has anything to return true for.
no setter
hashCode → int
The hash code for this object.
no setterinherited
id → String
The id of the drawing which should be unique for each drawing in InteractiveLayer.
no setterinherited
interactableDrawing → T
The reference to the InteractableDrawing instance of the drawing tool that is going to be added.
final
interactiveLayerBehaviour → InteractiveLayerBehaviour
The current interactive layer behaviour which is active and defines how this preview should behave.
final
onAddingStateChange → dynamic Function(AddingStateInfo)
A callback to the current step of the tool adding process.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

hitTest(Offset offset, EpochToX epochToX, QuoteToY quoteToY) → bool
Returns true if the drawing tool is hit by the given offset.
inherited
isInViewPort(EpochRange epochRange, QuoteRange quoteRange) → bool
Determines if the drawing preview is within the current chart viewport.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onCreateTap(TapUpDetails details, EpochFromX epochFromX, QuoteFromY quoteFromY, EpochToX epochToX, QuoteToY quoteToY) → void
Handles tap events during the drawing creation process.
onDragEnd(DragEndDetails details, EpochFromX epochFromX, QuoteFromY quoteFromY, EpochToX epochToX, QuoteToY quoteToY) → void
Handles the end of a drag gesture during drawing creation.
override
onDragStart(DragStartDetails details, EpochFromX epochFromX, QuoteFromY quoteFromY, EpochToX epochToX, QuoteToY quoteToY) → void
Handles the start of a drag gesture during drawing creation.
override
onDragUpdate(DragUpdateDetails details, EpochFromX epochFromX, QuoteFromY quoteFromY, EpochToX epochToX, QuoteToY quoteToY) → void
Handles updates during a drag gesture for drawing creation.
override
onHover(PointerHoverEvent event, EpochFromX epochFromX, QuoteFromY quoteFromY, EpochToX epochToX, QuoteToY quoteToY) → void
Handles hover events during drawing creation (desktop platforms).
override
onLongPressEnd(EpochFromX epochFromX, QuoteFromY quoteFromY, EpochToX epochToX, QuoteToY quoteToY) → void
Called when a long press ends on the drawing tool.
override
onLongPressStart(Offset localPosition, EpochFromX epochFromX, QuoteFromY quoteFromY, EpochToX epochToX, QuoteToY quoteToY) → void
Called when a long press starts on the drawing tool.
override
paint(Canvas canvas, Size size, EpochToX epochToX, QuoteToY quoteToY, AnimationInfo animationInfo, ChartConfig chartConfig, ChartTheme chartTheme, GetDrawingState getDrawingState) → void
Paints the drawing tool on the chart.
inherited
paintOverYAxis(Canvas canvas, Size size, EpochToX epochToX, QuoteToY quoteToY, EpochFromX? epochFromX, QuoteFromY? quoteFromY, AnimationInfo animationInfo, ChartConfig chartConfig, ChartTheme chartTheme, GetDrawingState getDrawingState) → void
Paints the drawing tool chart but over the Y-axis.
override
shouldRepaint(Set<DrawingToolState> drawingState, DrawingV2 oldDrawing) → bool
Determines if the drawing preview needs to be repainted.
override
toString() → String
A string representation of this object.
inherited

Operators

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