slot_machine_effect 0.0.5
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 #
-
SlotMachineReelControllerno longer requiresinitialValue. Omit it and the reel rests on the first entry in itsvalueslist:// 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
initialValuestill works as before, so existing code is unaffected. -
SlotMachineReelController.valueis nowint?. It isnullwhen noinitialValuewas given andspinhas not yet been called.
0.0.4 #
-
Breaking: replaced
targetandplaceholderwithcontroller, aSlotMachineReelController. Spins are no longer driven by a value change — they only happen when you callcontroller.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 spinOne 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
itemCountwithvalues, the list of values on the reel.targetandplaceholdernow name entries from that list rather than bare indices, so the faces need not be0-9or contiguous:// before itemCount: 10, target: 7, // after values: const [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], target: 7, -
Breaking: replaced
durationwithspinRate, a speed multiplier (1.0by default,2.0for twice as fast).durationset 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. NowspinRatefixes the pace,spinsfixes 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
onSettledif 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
targetchanging, so a screen can show a resting value without animating into it. To spin on load, changetargetafter the first frame. - Added
placeholder: the value the reel rests on before its first spin, defaulting totarget. 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 totargetand 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,bounceExtentandbounceDuration;onSpinStartandonSettledcallbacks. - Spin requests arriving mid-spin are ignored, so the animation cannot be broken by repeated taps.