flutter_crazy_fortune_wheel

pub package

flutter_crazy_fortune_wheel

Getting Started

If you use the SlicedWheel (or the RandomWheel), you will need to add this shader to your pubspec.yaml:

flutter:
  shaders:
    - packages/flutter_crazy_fortune_wheel/shaders/sliced_wheel_shader.frag

Create an animationController, and optionally "drive" it using FortuneWheelCurve to improve the animation:

  late final controller = AnimationController(
    vsync: this,
    duration: const Duration(seconds: 10),
  );
  late final animation = controller.drive(CurveTween(curve: FortuneWheelCurve()));

Create the wheel:

NormalWheel( // or SlicedWheel, DisappearingWheel, or RandomWheel
    animation: animation, // AnimationController or animation<double>
    winnerIndex: winnerIndex, // For example: winnerIndex = Random.secure().nextInt(childrenMedium.length);
    children: children, // The widgets that will be displayed on the wheel
),