gamification_wheel
A fully customizable, animated spinning wheel widget for Flutter. Perfect for games, rewards, decision-making, and interactive apps. Not for gambling or betting purposes.
Features
- ๐ฏ Customizable segments (text, color, probability)
- ๐จ Modern Material 3 UI
- โก Smooth, high-performance animations
- ๐ Weighted probability (fair, customizable spins)
- ๐ผ๏ธ Custom pointer and center widget
- ๐ฑ Responsive (mobile, web, desktop)
- ๐ ๏ธ Easy integration, no external state management required
- ๐ Null safety and up-to-date Flutter support
Demo
Installation
Add to your pubspec.yaml
:
dependencies:
gamification_wheel: ^0.1.4
Then run:
flutter pub get
Quick Usage
import 'package:gamification_wheel/gamification_wheel.dart';
import 'package:flutter/material.dart';
final segments = [
WheelSegment(id: '1', text: 'Pizza', color: Colors.red, probability: 2.0),
WheelSegment(id: '2', text: 'Burger', color: Colors.teal, probability: 1.0),
WheelSegment(id: '3', text: 'Sushi', color: Colors.blue, probability: 1.0),
// ... more segments
];
GWheel(
segments: segments,
wheelSize: 300,
animationSpeed: 2.0,
showPointer: true,
enableTapToSpin: true,
showCenterDot: true,
showWheelShadow: true,
centerWidget: Icon(Icons.star, size: 40, color: Colors.white),
onFinish: (result) {
print('You got: ${result.text}');
},
)
More Examples
Custom Pointer Example
GWheel(
segments: segments,
customPointer: Icon(Icons.arrow_drop_down, size: 48, color: Colors.amber),
onFinish: (result) {
// handle result
},
)
Custom Spin Button Example
GWheel(
segments: segments,
customSpinButton: ElevatedButton(
onPressed: () {/* spin logic */},
child: Text('Try Your Luck!'),
),
)
Customization
- Wheel Size:
wheelSize
(e.g. 200-400) - Animation Speed:
animationSpeed
(0.5x to 3.0x) - Segment Colors: Now use Flutter
Color
objects (e.g.Colors.red
) - Probability: Set different weights for each segment
- Pointer & Center Widget: Fully customizable
- Styling: Shadows, borders, font styles, and more
Documentation & Changelog
Changelog (v0.1.4)
๐ Breaking Changes
- Color Parameters Updated: Colors are now provided as Flutter
Color
objects instead of strings. All related functions and widget parameters have been updated accordingly.
๐งน Cleanup & Improvements
- Removed Unused Dependencies: All unnecessary dependencies have been completely removed from the project.
- Color Utils Updated: Helper functions for color (
rainbowColor
,colorToHex
, etc.) have been updated and moved to utils, following modern Dart/Flutter standards. - Documentation Updated: Developer and user documentation has been simplified and cleaned up to reflect these changes.
License
MIT License. See LICENSE.
Contributing
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
โ ๏ธ Important Notice
This package is NOT intended for gambling, betting, or any real-money gaming purposes. It is designed for gamification, education, entertainment, and decision-making apps only.
Libraries
- core/constants/color_constants
- core/constants/wheel_constants
- core/di/injection_container
- core/utils/helpers/init/app_initialize
- data/datasources/wheel_local_datasource
- data/repositories/wheel_repository_impl
- domain/entities/common/base_entity
- domain/entities/entities
- domain/entities/wheel/wheel_segment
- domain/repositories/wheel_repository
- domain/usecases/spin_wheel_usecase
- gamification_wheel
- main
- presentation/blocs/wheel/events
- presentation/blocs/wheel/states
- presentation/blocs/wheel/wheel_bloc
- presentation/blocs/wheel_display/events
- presentation/blocs/wheel_display/states
- presentation/blocs/wheel_display/wheel_display_bloc
- presentation/blocs/wheel_widget/events
- presentation/blocs/wheel_widget/states
- presentation/blocs/wheel_widget/wheel_widget_bloc
- presentation/pages/main_app
- presentation/pages/wheel_page
- presentation/widgets/wheel/wheel_animation_controller
- presentation/widgets/wheel/wheel_controls
- presentation/widgets/wheel/wheel_display
- presentation/widgets/wheel/wheel_painter
- presentation/widgets/wheel/wheel_widget
- presentation/widgets/wheel/wheel_widget_export
- wheel