fancy_slot_machine 0.0.3
fancy_slot_machine: ^0.0.3 copied to clipboard
A premium, customizable Slot Machine / Drum widget for draws and winners selection in Flutter.
🎰 Fancy Slot Machine for Flutter #
A premium, highly customizable, and buttery-smooth Slot Machine / Drum widget for Flutter.
📸 Visual Showcase #
Experience the smooth physics and luxury gold aesthetics in action.
Live Animation
|
Modern UI
|
Winner Celebration
|
Features • Why Us? • Getting Started • API
Features #
- Generic Type Support: Works with any data model.
- Integrated Spin Logic: Built-in "Spin" button and animation state management.
- Fully Customizable: Control colors, durations, text styles, and drum aesthetics.
- Smooth Physics: Uses ListWheelScrollView for a realistic 3D drum rotation effect.
- Remote Triggering: Control the winner and animation from external state.
- Responsive & Lightweight: Optimized for mobile performance.
Why Fancy Slot Machine? #
Competitive Edge #
Unlike basic carousel or slot widgets, this package focus on Visual Trust. When users see a high-fidelity animation and premium design, they perceive the drawing process as more credible and professional.
Technical Superiority #
- Lazy Loading: Using
childDelegate, only items currently in view are rendered, saving memory and CPU cycles. - Deterministic Mechanics: The stopping algorithm calculates the exact offset needed for multiple full rotations before landing, ensuring a perfect "suspense" phase.
Comparison: Fancy Slot Machine vs. Others #
| Feature | Standard Packages | Fancy Slot Machine 🚀 |
|---|---|---|
| Visual Aesthetics | Flat colors, outdated design. | Modern Luxury Design (Gold gradients, glassmorphism, professional shadows). |
| Animation Physics | Linear or abrupt stopping. | Elastic Bouncy Physics (Realistic inertia and "bounce" when landing). |
| Data Interaction | Often requires manual widget mapping. | Generic Data Builders (Pass your Model directly, it handles the rest). |
| Customization | Complex setup for frames/indicators. | Plug & Play UI (Pre-styled frame, indicators, and integrated spin button). |
| Performance | Laggy infinite scrolls. | Seamless Infinite Loop (High performance via Delegates handles 10,000+ items). |
| Best For | Simple mini-games. | Premium Apps & Official Draws (Admin panels, high-stakes competitions). |
Key Value Pillars #
- Zero Setup Time: Don't waste hours designing the drum. Just pass your list and
labelBuilderand enjoy the magic. - High Performance: Built with
ListWheelScrollView.useDelegateensuring 60/120 FPS even with massive datasets. - Visual Trust: The premium aesthetic builds trust with participants, making the draw feel official and fair.
Installation #
Add fancy_slot_machine to your pubspec.yaml:
dependencies:
fancy_slot_machine: ^0.0.1
iconsax: ^0.0.8
Usage #
import 'package:fancy_slot_machine/fancy_slot_machine.dart';
FancySlotMachine<String>(
items: ['Alice', 'Bob', 'Charlie'],
labelBuilder: (item) => item,
onSpinStart: () => print('Spinning!'),
onWinnerSelected: (winner) => print('Winner: $winner'),
)
API Reference #
| Property | Type | Description |
|---|---|---|
| items | List | The list of items to spin through. |
| labelBuilder | String Function(T) | How to extract the name. |
| onSpinStart | VoidCallback | Called when spin begins. |
| onWinnerSelected | Function(T) | Called when winner is picked. |
| selectedWinner | T? | Set this to target a winner. |
| isSpinning | bool | Control spinning state. |
| accentColor | Color | Primary theme color. |
Developer #
Developed by Hamdy Haggag.
- GitHub: @hamdyhaggag
- Portfolio: hamdyhaggag.netlify.app