DragTrack class final
Makes a dragged node a value control (a knob, a fader): it moves along
the track as variable variable goes from min to max, and the
design canvas draws it at the variable's value. Dragging it writes the
variable (unless write is off); a double tap goes to defaultValue
(or through doubleTapValues), the wheel and arrow keys step it. Inside
it ${track.value}, ${track.progress}, ${track.dragging},
${track.fine} and ${track.focused} can be read.
Its settings and geometry are bindable as drag.track.<field>
(drag.track.x2: ${= parent.width - 26}); drag.track.value gives
the value the node is drawn at in place of reading variable.
- Annotations
-
- @immutable
Constructors
-
DragTrack({DragTrackShape shape = DragTrackShape.line, String variable = '', double min = 0, double max = 1, double step = 0, double? defaultValue, DragTrackInput input = DragTrackInput.follow, double pixelsPerRange = 200, double x1 = 0, double y1 = 0, double x2 = 0, double y2 = -100, double startAngle = -135, double endAngle = 135, double pivotX = 0, double pivotY = 0, bool rotate = true, String? path, bool orientToPath = false, bool jumpOnTap = false, bool wheel = true, double? value, bool orientUpright = false, double detent = 0, double overscroll = 0, int settle = 0, AnimationCurve settleCurve = AnimationCurve.easeOutCubic, double settleStiffness = 380, double settleDamping = 20, double? parkedProgress, bool keyboard = true, double viewBoxWidth = 0, double viewBoxHeight = 0, bool relative = false, double? wheelStep, List<
double> doubleTapValues = const [], double? keyStep, DragTrackHitArea hitArea = DragTrackHitArea.self, DragTrackUnits units = DragTrackUnits.pixels, double fineStep = 0, double finePixelsPerRange = 0, int fineHold = 380, String fineVariable = '', int snap = 0, AnimationCurve snapCurve = AnimationCurve.easeOutBack, bool write = true, bool endless = false, bool momentum = false, double friction = 2.6, bool smooth = false, double gain = 1}) -
const
Properties
- defaultValue → double?
-
What a double tap resets to (bindable as
drag.track.defaultValue).final - detent → double
-
How magnetic steps are while dragging (0–1): 0 jumps from step to
step; above 0 the node follows that share of the way past a step.
final
-
doubleTapValues
→ List<
double> -
Values a double tap moves between, in order (empty: defaultValue).
final
- effectiveFinePixelsPerRange → double
-
no setter
- effectiveKeyStep → double?
-
Null with keyboard off.
no setter
- effectiveWheelStep → double
-
no setter
- endAngle → double
-
An arc's angles (degrees, clockwise, 0 up) about the pivot (from the
node's center).
final
- endless → bool
-
An arc that keeps turning past its ends, the value unbounded (a
combination dial).
final
- fineHold → int
-
final
- finePixelsPerRange → double
-
A finer step while Shift is held or after the pointer is held still
fineHold ms (0: hold doesn't), finePixelsPerRange pixels for the
range (0: 4 × pixelsPerRange); 0 has no fine mode. fineVariable, a
boolean variable, is kept true while fine.
final
- fineStep → double
-
A finer step while Shift is held or after the pointer is held still
fineHold ms (0: hold doesn't), finePixelsPerRange pixels for the
range (0: 4 × pixelsPerRange); 0 has no fine mode. fineVariable, a
boolean variable, is kept true while fine.
final
- fineVariable → String
-
final
- friction → double
-
final
- gain → double
-
How far the node moves per pointer movement (0.5 fine, 2 coarse).
final
- hasFine → bool
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasVariable → bool
-
no setter
- hitArea → DragTrackHitArea
-
final
- input → DragTrackInput
-
final
- jumpOnTap → bool
-
Pressing anywhere along the track (or the hitArea) moves the node
there, then the drag goes on (only for DragTrackInput.follow).
final
- keyboard → bool
-
Takes keyboard focus: arrows step by keyStep (else step, else 1%
of the range), Page Up/Down by 10 steps, Home and End to the ends.
final
- keyStep → double?
-
One wheel notch, one arrow key (null: step, else 1% of the range).
final
- max → double
-
final
- min → double
-
final
- momentum → bool
-
Let go while moving, it coasts, slowing by friction per second, then
settles on a step.
final
- orientToPath → bool
-
final
- orientUpright → bool
-
With orientToPath, never upside down (as Motion.orientUpright).
final
- overscroll → double
-
How far it can be dragged past an end, a share of the pointer's
travel there (0–1); it springs back on release.
final
- parkedProgress → double?
-
Where the node parks while the value is out of range or empty, as a
progress that may lie outside 0–1 (an unrated dial parks below its
first mark); null draws such a value at the nearest end.
final
- path → String?
-
final
- pivotX → double
-
An arc's angles (degrees, clockwise, 0 up) about the pivot (from the
node's center).
final
- pivotY → double
-
An arc's angles (degrees, clockwise, 0 up) about the pivot (from the
node's center).
final
- pixelsPerRange → double
-
final
-
props
→ List<
Object?> -
no setter
- relative → bool
-
A line's ends are multiples of the node's own size (a full-width scrub
area:
x1: -0.5, x2: 0.5).final - rotate → bool
-
Turns the node with the arc.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- settle → int
-
The glide to its value's place when not following the pointer (ms; 0
jumps), its curve, and the spring of AnimationCurve.spring (mass 1),
which a release mid-fling starts at the pointer's speed.
final
- settleCurve → AnimationCurve
-
final
- settleDamping → double
-
final
- settleStiffness → double
-
final
- shape → DragTrackShape
-
final
- smooth → bool
-
Draws the node between steps while dragged or coasting, springing
onto the nearest when it rests (the variable only holds steps).
final
- snap → int
-
Animates the node to each new value over snap ms along snapCurve
(a knob clicking from detent to detent); 0 jumps.
final
- snapCurve → AnimationCurve
-
final
- startAngle → double
-
An arc's angles (degrees, clockwise, 0 up) about the pivot (from the
node's center).
final
- step → double
-
final
- unbounded → bool
-
Whether the value is unbounded (endless on an arc).
no setter
- units → DragTrackUnits
-
final
- usesViewBox → bool
-
no setter
- value → double?
-
The value the node is drawn at, from a binding (
drag.track.value); null reads variable.final - variable → String
-
The variable it reads and writes; empty when
drag.track.valueis bound and its reactions write the value.final - viewBoxHeight → double
-
With both above 0, path is drawn in the box of the frame the node
sits in, in these units, stretched to the frame's size.
final
- viewBoxWidth → double
-
With both above 0, path is drawn in the box of the frame the node
sits in, in these units, stretched to the frame's size.
final
- wheel → bool
-
Whether the mouse wheel steps the value.
final
- wheelStep → double?
-
One wheel notch, one arrow key (null: step, else 1% of the range).
final
- write → bool
-
Whether dragging writes variable; off, it only shows it and its
reactions set what changes from
${result.value}.final - x1 → double
-
A line's ends, from the node's place (pixels, or with relative
multiples of the node's size, with units parent of the parent's).
final
- x2 → double
-
A line's ends, from the node's place (pixels, or with relative
multiples of the node's size, with units parent of the parent's).
final
- y1 → double
-
A line's ends, from the node's place (pixels, or with relative
multiples of the node's size, with units parent of the parent's).
final
- y2 → double
-
A line's ends, from the node's place (pixels, or with relative
multiples of the node's size, with units parent of the parent's).
final
Methods
-
angleAt(
double progress) → double -
clampProgress(
double progress) → double -
progressheld to the track (any progress on an endless arc). -
doubleTapTarget(
double v) → double? -
The value a double tap moves to from
v, or null when it does nothing. -
isParked(
double value) → bool -
Whether
valueis drawn at parkedProgress (out of range, or NaN for an empty variable). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
progressOf(
double value) → double -
Where
valueis along the track (0–1; past them on an endless arc). -
restProgressOf(
double value) → double -
Where the node is drawn for
value. -
snapTo(
double v, double by) → double -
vsnapped toby(from min; 0 continuous) and kept in range. -
snapValue(
double v) → double -
toJson(
) → Json -
toString(
) → String -
A string representation of this object.
inherited
-
valueAt(
double progress) → double -
The value at
progress, snapped to step.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited