slot_machine_effect 0.0.5 copy "slot_machine_effect: ^0.0.5" to clipboard
slot_machine_effect: ^0.0.5 copied to clipboard

A slot machine reel for Flutter. Spins up, drifts to a stop on the value you ask for, and rocks into place with a small bounce.

0.0.5 #

  • SlotMachineReelController no longer requires initialValue. Omit it and the reel rests on the first entry in its values list:

    // before — had to name an explicit starting value
    controller: SlotMachineReelController(initialValue: someValue),
    // after — first value in the list is shown by default
    controller: SlotMachineReelController(),
    

    Passing initialValue still works as before, so existing code is unaffected.

  • SlotMachineReelController.value is now int?. It is null when no initialValue was given and spin has not yet been called.

0.0.4 #

  • Breaking: replaced target and placeholder with controller, a SlotMachineReelController. Spins are no longer driven by a value change — they only happen when you call controller.spin(value) — and the controller now owns the reel's current value:

    // before
    target: result, placeholder: -1,
    // after
    controller: myController, // SlotMachineReelController(initialValue: -1)
    // ...then call myController.spin(result) whenever you want it to spin
    

    One consequence: spinning to the same value twice in a row is no longer a silent no-op. Every spin() call runs a spin, even a repeat.

0.0.3 #

  • Breaking: replaced itemCount with values, the list of values on the reel. target and placeholder now name entries from that list rather than bare indices, so the faces need not be 0-9 or contiguous:

    // before
    itemCount: 10, target: 7,
    // after
    values: const [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], target: 7,
    
  • Breaking: replaced duration with spinRate, a speed multiplier (1.0 by default, 2.0 for twice as fast). duration set how long a spin lasted, which meant a longer duration spun slower rather than further, and a reel's speed changed with how far it had to travel. Now spinRate fixes the pace, spins fixes the distance, and the time follows from both:

    // before
    duration: const Duration(milliseconds: 2100),
    // after — same pace as the old default
    spinRate: 1.0,
    

    Reels now visibly move at the same speed regardless of their target. Use onSettled if you need to know when a spin finishes.

  • Tests are no longer shipped in the published archive.

0.0.2 #

  • Breaking: the reel no longer spins when it first appears. Spins are now driven solely by target changing, so a screen can show a resting value without animating into it. To spin on load, change target after the first frame.
  • Added placeholder: the value the reel rests on before its first spin, defaulting to target. Useful for parking on a blank face until a result is ready to reveal.

0.0.1 #

  • Initial release.
  • SlotMachineReel: a looping reel that spins to target and settles with a bounce.
  • Continuous velocity-profile motion — wind-up, run, wind-down, bounce — with no speed discontinuity between phases.
  • Configurable duration, delay, spins, reverse, bounceExtent and bounceDuration; onSpinStart and onSettled callbacks.
  • Spin requests arriving mid-spin are ignored, so the animation cannot be broken by repeated taps.
1
likes
160
points
320
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A slot machine reel for Flutter. Spins up, drifts to a stop on the value you ask for, and rocks into place with a small bounce.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter

More

Packages that depend on slot_machine_effect