Track class final

A value the user sets by dragging (node key track): Flutter's Slider (value, min, max, divisions as step, onChanged as the changed reaction, onChangeEnd as changeEnd), generalised from a straight bar to a line, an arc or any path. The node carrying it is the thumb: 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; the wheel and arrow keys step it. Inside it ${track.value}, ${track.progress}, ${track.dragging} and ${track.focused} can be read; it fires changed (${result.value}, from, direction, crossed), dragEnd and changeEnd.

Its settings and geometry are bindable as track.<field> (track.x2: ${= parent.width - 26}); track.value gives the value the node is drawn at in place of reading variable.

Annotations
  • @immutable

Constructors

Track({bool enabled = true, String variable = '', double? value, double min = 0, double max = 1, double step = 0, bool clamp = true, TrackInput input = TrackInput.follow, TrackInteraction allowedInteraction = TrackInteraction.slideThumb, TrackHitArea hitArea = TrackHitArea.self, double pixelsPerRange = 200, double? wheelStep, double? keyStep, TrackShape shape = TrackShape.line, double x1 = 0, double y1 = 0, double x2 = 0, double y2 = -100, bool relative = false, TrackUnits units = TrackUnits.pixels, double startAngle = -135, double sweepAngle = 270, double pivotX = 0, double pivotY = 0, bool rotate = true, PathFollow? path, double detent = 0, double overscroll = 0, GesturePhysics? physics, int settle = 0, AnimationCurve settleCurve = AnimationCurve.easeOutCubic, Spring settleSpring = Track.defaultSettleSpring, int snap = 0, AnimationCurve snapCurve = AnimationCurve.easeOutBack})
const

Properties

allowedInteraction → TrackInteraction
final
clamp → bool
Whether the value stays within min–max. Off, an TrackShape.arc keeps turning past its ends and the value counts on (a combination dial).
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
effectiveKeyStep → double?
Null with the keys off (keyStep 0).
no setter
effectiveWheelStep → double
no setter
enabled → bool
Whether it takes the pointer, the wheel and the keys (bindable as track.enabled).
final
endAngle → double
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasVariable → bool
no setter
hitArea → TrackHitArea
With TrackHitArea.parent the node's parent takes the pointer too.
final
input → TrackInput
final
jumpOnTap → bool
no setter
keyStep → double?
One wheel notch, one arrow key: null step, else 1% of the range; 0 turns the wheel or the keys off. With the keys on it takes focus: arrows step, Page Up/Down by 10 steps, Home and End to the ends.
final
max → double
The range and its step (Slider.divisions = (max − min) / step; 0 is continuous).
final
min → double
The range and its step (Slider.divisions = (max − min) / step; 0 is continuous).
final
momentum → bool
no setter
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
path → PathFollow?
A path (TrackShape.path): its SVG data in pixels from the node's place, or in a view box stretched over the parent, and whether the node turns with it.
final
physics → GesturePhysics?
Let go while moving, with GesturePhysics.fling it coasts on, slowing by GesturePhysics.friction, then settles on a step. Null stops where let go.
final
pivotX → double
An arc: the angle of min (degrees, clockwise, 0 up) and the turn to max, about the pivot (from the node's center); the node orbits it on the circle through its place, turning with it (rotate). A pivot at the center is a knob that turns in place.
final
pivotY → double
An arc: the angle of min (degrees, clockwise, 0 up) and the turn to max, about the pivot (from the node's center); the node orbits it on the circle through its place, turning with it (rotate). A pivot at the center is a knob that turns in place.
final
pixelsPerRange → double
Pixels of drag for the whole range (TrackInput.vertical, TrackInput.horizontal, TrackInput.both).
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
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
settleSpring → Spring
The spring of a spring settleCurve (JSON settleSpring).
final
shape → TrackShape
Inferred from path when not given.
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: the angle of min (degrees, clockwise, 0 up) and the turn to max, about the pivot (from the node's center); the node orbits it on the circle through its place, turning with it (rotate). A pivot at the center is a knob that turns in place.
final
step → double
The range and its step (Slider.divisions = (max − min) / step; 0 is continuous).
final
sweepAngle → double
An arc: the angle of min (degrees, clockwise, 0 up) and the turn to max, about the pivot (from the node's center); the node orbits it on the circle through its place, turning with it (rotate). A pivot at the center is a knob that turns in place.
final
unbounded → bool
Whether the value is unbounded (not clamped).
no setter
units → TrackUnits
final
usesViewBox → bool
no setter
value → double?
The value the node is drawn at, from a binding (track.value); null reads variable.
final
variable → String
The variable it reads and writes; empty when track.value is bound and its reactions write the value.
final
wheel → bool
Whether the wheel steps it.
no setter
wheelStep → double?
One wheel notch, one arrow key: null step, else 1% of the range; 0 turns the wheel or the keys off. With the keys on it takes focus: arrows step, Page Up/Down by 10 steps, Home and End to the ends.
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
progress held to the track (any progress when unbounded).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
progressOf(double value) → double
Where value is along the track (0–1; past them when unbounded).
restProgressOf(double value) → double
Where the node is drawn for value.
snapTo(double v, double by) → double
v snapped to by (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

Static Methods

fromJson(Object? json) → Track?

Constants

defaultSettleSpring → const Spring