FortuneWheel constructor

FortuneWheel(
  1. {Key? key,
  2. required List<FortuneItem> items,
  3. int rotationCount = FortuneWidget.kDefaultRotationCount,
  4. Stream<int> selected = const Stream<int>.empty(),
  5. Duration duration = FortuneWidget.kDefaultDuration,
  6. Curve curve = FortuneCurve.spin,
  7. List<FortuneIndicator> indicators = kDefaultIndicators,
  8. StyleStrategy styleStrategy = kDefaultStyleStrategy,
  9. bool animateFirst = true,
  10. VoidCallback? onAnimationStart,
  11. VoidCallback? onAnimationEnd,
  12. Alignment alignment = Alignment.topCenter,
  13. HapticImpact hapticImpact = HapticImpact.none,
  14. PanPhysics? physics,
  15. VoidCallback? onFling,
  16. ValueChanged<int>? onFocusItemChanged}
)

Creates a new FortuneWheel with the given items, which is centered on the selected value.

{@macro flutter_fortune_wheel.FortuneWidget.ctorArgs}.

See also:

  • FortuneBar, which provides an alternative visualization.

Implementation

FortuneWheel({
  Key? key,
  required this.items,
  this.rotationCount = FortuneWidget.kDefaultRotationCount,
  this.selected = const Stream<int>.empty(),
  this.duration = FortuneWidget.kDefaultDuration,
  this.curve = FortuneCurve.spin,
  this.indicators = kDefaultIndicators,
  this.styleStrategy = kDefaultStyleStrategy,
  this.animateFirst = true,
  this.onAnimationStart,
  this.onAnimationEnd,
  this.alignment = Alignment.topCenter,
  this.hapticImpact = HapticImpact.none,
  PanPhysics? physics,
  this.onFling,
  this.onFocusItemChanged,
})  : physics = physics ?? CircularPanPhysics(),
      assert(items.length > 1),
      super(key: key);