FortuneBar class Null safety

A fortune bar visualizes a (random) selection process as a horizontal bar divided into uniformly sized boxes, which correspond to the number of items. When spinning, items are moved horizontally for duration.

See also:

Inheritance
Implemented types

Constructors

FortuneBar({Key? key, double height = 56.0, Duration duration = FortuneWidget.kDefaultDuration, VoidCallback? onAnimationStart, VoidCallback? onAnimationEnd, Curve curve = FortuneCurve.spin, required Stream<int> selected, int rotationCount = FortuneWidget.kDefaultRotationCount, required List<FortuneItem> items, List<FortuneIndicator> indicators = kDefaultIndicators, bool fullWidth = false, StyleStrategy styleStrategy = kDefaultStyleStrategy, bool animateFirst = true, int visibleItemCount = kDefaultVisibleItemCount, VoidCallback? onFling, PanPhysics? physics})
Creates a new FortuneBar 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
fullWidth bool
If this value is true, this widget expands to the screen width and ignores width constraints imposed by parent widgets. [...]
final
hashCode int
The hash code for this object. [...]
@nonVirtual, read-only, inherited
height double
Requires this widget to have exactly this height.
final
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 FortuneItems to be shown within this FortuneWidget.
final
key Key?
Controls how one widget replaces another widget in the tree. [...]
final, inherited
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.
read-only, inherited
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
visibleItemCount int
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. [...]
@protected, inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent 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. [...]
@nonVirtual, inherited

Constants

kDefaultIndicators → const List<FortuneIndicator>
const <FortuneIndicator>[const FortuneIndicator(alignment: Alignment.topCenter, child: const RectangleIndicator())]
kDefaultStyleStrategy → const StyleStrategy
const UniformStyleStrategy(borderWidth: 4)
kDefaultVisibleItemCount → const int
3