FortuneWheel class
A fortune wheel visualizes a (random) selection process as a spinning wheel divided into uniformly sized slices, which correspond to the number of items.
See also:
- FortuneBar, which provides an alternative visualization
- FortuneWidget(), which automatically chooses a fitting widget
- Fortune.randomItem, which helps selecting random items from a list
- Fortune.randomDuration, which helps choosing a random duration
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- FortuneWheel
- Implemented types
Constructors
-
FortuneWheel({Key? key, required List<
FortuneItem> items, int rotationCount = FortuneWidget.kDefaultRotationCount, Stream<int> selected = const Stream<int>.empty(), Duration duration = FortuneWidget.kDefaultDuration, Curve curve = FortuneCurve.spin, List<FortuneIndicator> indicators = kDefaultIndicators, StyleStrategy styleStrategy = kDefaultStyleStrategy, bool animateFirst = true, VoidCallback? onAnimationStart, VoidCallback? onAnimationEnd, PanPhysics? physics, VoidCallback? onFling}) - Creates a new FortuneWheel with the given items, which is centered on the selected value.
Properties
- animateFirst → bool
-
Determines if this widget animates during its first build.
final
- curve → Curve
-
The type of curve to use for easing the animation when selected changes.
final
- duration → Duration
-
The animation duration used for FortuneCurve.spin
within FortuneWidget instances.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
indicators
→ List<
FortuneIndicator> -
The list of indicators is rendered on top of the underlying
FortuneWidget. These can be used to visualize the position of the
selected item.
final
-
items
→ List<
FortuneItem> -
A list of
FortuneItem
s to be shown within this FortuneWidget.final - key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onAnimationEnd → VoidCallback?
-
Called when this widget's animation ends.
Useful for enabling other widgets after the animation ends.
final
- onAnimationStart → VoidCallback?
-
Called when this widget starts an animation.
Useful for disabling other widgets during the animation.
final
- onFling → VoidCallback?
-
Called when a fling gesture is detected by the active physics.
final
- physics → PanPhysics
-
The behavior used for handling pan events on this widget.
final
- rotationCount → int
-
The number of times a FortuneWidget rotates around all
items before it settles on the selected value.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
selected
→ Stream<
int> -
A stream notifying this widget that a new value within items was selected.
Used by FortuneWidgets to align indicators on the selected item.
final
- styleStrategy → StyleStrategy
-
The strategy to use for styling individual items when they have no
dedicated FortuneItem.style.
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → _StatelessHookElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
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}) → 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
Constants
-
kDefaultIndicators
→ const List<
FortuneIndicator> - The default value for indicators on a FortuneWheel. Currently uses a single TriangleIndicator on Alignment.topCenter.
- kDefaultStyleStrategy → const StyleStrategy