WheelSpinner class
A candy-styled "wheel of fortune" — draws its own pie-slice wheel via CustomPaint (no extra package dependency), spins to whatever index controller requests, and reports the landed WheelSegment via onSpinEnd. A fixed pointer marks the winning slice at the top; the wheel itself is the only thing that rotates.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- WheelSpinner
Constructors
-
WheelSpinner({Key? key, required List<
WheelSegment> segments, required WheelSpinnerController controller, required ValueChanged<WheelSegment> onSpinEnd, VoidCallback? onTick, bool enableHaptics = true, double size = 260, Duration spinDuration = const Duration(seconds: 3), int extraTurns = 4}) -
const
Properties
- controller → WheelSpinnerController
-
final
- enableHaptics → bool
-
final
- extraTurns → int
-
Extra full rotations before landing, purely for visual effect.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
onSpinEnd
→ ValueChanged<
WheelSegment> -
final
- onTick → VoidCallback?
-
Called once for every segment boundary crossed during the spin. A host
app can use this seam to play its own tick sound.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
segments
→ List<
WheelSegment> -
final
- size → double
-
final
- spinDuration → Duration
-
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< WheelSpinner> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
validateConfiguration(
{required List< WheelSegment> segments, required double size, required Duration spinDuration, required int extraTurns}) → void - Validates inputs at runtime so release builds keep the same contract as debug builds (where constructor assertions are enabled).