my_spin_wheel 0.0.3
my_spin_wheel: ^0.0.3 copied to clipboard
Flutter spin wheel widget which will stop at your desired item.
Flutter spin wheel widget which will stop at your desired item.
Features #
Getting started #
Usage #
MySpinController mySpinController = MySpinController();
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
width: double.infinity,
height: double.infinity,
decoration: const BoxDecoration(
color: Color(0xff0C1B3A)
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
MySpinner(
mySpinController: mySpinController,
wheelSize: Get.width * 0.6,
itemList: [
SpinItem(label: 'Apple', color: const Color(0xff4760A8)),
SpinItem(label: 'Banana', color: const Color(0xffBFC8E1)),
SpinItem(label: 'Cucumber', color: const Color(0xff75AB53)),
SpinItem(label: 'Durian', color: const Color(0xffD1DC58)),
SpinItem(label: 'Apple', color: const Color(0xff4760A8)),
SpinItem(label: 'Banana', color: const Color(0xffBFC8E1)),
// SpinItem(label: 'Eggplant', color: Colors.redAccent),
// SpinItem(label: 'Flower', color: Colors.lightBlueAccent),
],
onFinished: (p0) {
},
),
circleOverlay(size: Get.width * 0.6,data: ['Apple','Banana','Cucumber','Durian']),
const SizedBox(height: 20,),
ElevatedButton(onPressed: () async{
int rdm = Random().nextInt(6);
await mySpinController.spinNow(luckyIndex: rdm+1,totalSpin: 10,baseSpinDuration: 20);
}, child: const Text('Spin Now')),
],
),
),
);
}