WheelGeometry class

The angular layout of the wheel's slices.

Slices are laid out clockwise starting at the top of the (unrotated) wheel. A rotation R (radians, clockwise) moves a point drawn at canvas angle θ to θ + R on screen.

Constructors

WheelGeometry.equal(int count)
count slices of equal size.
factory
WheelGeometry.weighted(List<double> weights)
Slices sized in proportion to weights. Falls back to equal sizes if all weights are zero.
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
length → int
The number of slices.
no setter
offsets → List<double>
Where each slice starts, measured clockwise from the top, in radians.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sweeps → List<double>
The angle each slice covers, in radians. Adds up to 2π.
final

Methods

endRotationFor({required double startRotation, required int index, required double fraction, required double pointerAngle, required int fullTurns, bool clockwise = true}) → double
The end rotation for a spin starting at startRotation that turns at least fullTurns whole turns in the given direction and stops with fraction of slice index under the pointer.
fractionAt(int index, double rotation, double pointerAngle) → double
Where within slice index the pointer is, from 0.0 (slice start) to 1.0 (slice end).
indexAt(double rotation, double pointerAngle) → int
The index of the slice under the pointer at pointerAngle when the wheel is rotated by rotation.
midAngle(int index) → double
The canvas angle through the middle of slice index (before rotation).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
restingRotationFor(int index, double fraction, double pointerAngle) → double
A rotation in [0, 2π) that puts the point at fraction of slice index under the pointer.
slicesEntered(double from, double to, double pointerAngle, {int limit = 100000}) → List<int>
The slices that come under the pointer, in order, as the wheel turns from rotation from to rotation to. A slice is listed each time the pointer enters it, so a full turn lists every visible slice once.
startAngle(int index) → double
The canvas angle at which slice index starts (before rotation).
toString() → String
A string representation of this object.
inherited

Operators

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