FortuneWheel constructor Null safety

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. PanPhysics? physics,
  13. VoidCallback? onFling}
)

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,
  PanPhysics? physics,
  this.onFling,
})  : physics = physics ?? CircularPanPhysics(),
      assert(items != null && items.length > 1),
      assert(curve != null),
      super(key: key);