flutter-spinning-wheel icon indicating copy to clipboard operation
flutter-spinning-wheel copied to clipboard

Wheel can be spun manually to a prize

Open zanesc opened this issue 5 years ago • 2 comments

Am i missing something here? This wheel can be spun with your finger to what ever section of the wheel you want and then the onEnd is called allowing the user to select which prize they want to win.

Also, onEnd is called when the user starts spinning the wheel and when the wheel ends.

zanesc avatar Jul 13 '20 22:07 zanesc

Hi, have you been able to solve this problem? I'm facing same.

waletoyo1 avatar Oct 02 '20 07:10 waletoyo1

hello, you can put the wheelspinner into a Stack widget with a container on top of each other but container should be on top, and container must have transparent color so it basicly prevents any touches to a spinner directly.

Stack( fit: StackFit.expand, children: [ Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ SpinningWheel( Image.asset('assets/images/wheel-6-300.png'), width: 310, height: 310, initialSpinAngle: _generateRandomAngle(), spinResistance: 0.2, dividers: 6, canInteractWhileSpinning: false, onUpdate: _dividerController.add, onEnd: _dividerController.add, shouldStartOrStop: _wheelNotifier.stream, ), StreamBuilder( stream: _dividerController.stream, builder: (context, snapshot) => snapshot.hasData ? BasicScore(snapshot.data) : Container(), ), FancyButton( child: Text("çevir"), size: 64, color: Colors.deepPurple, onPressed: () { setState(() { _wheelNotifier.sink.add(_generateRandomVelocity()); }); }, ) ], ), Center( child: Container( margin: EdgeInsets.only(bottom: 60), width: 310, height: 310, color: Colors.transparent, ), ), ], ),

xalife avatar Apr 28 '21 23:04 xalife