slot_machine_ui 1.3.6 copy "slot_machine_ui: ^1.3.6" to clipboard
slot_machine_ui: ^1.3.6 copied to clipboard

A highly customizable slot machine widget for Flutter with smooth animations, beautiful skeuomorphic design, and sound support.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:slot_machine_ui/slot_machine_ui.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Slot Machine Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        useMaterial3: true,
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.red),
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final SlotMachineController _controller = SlotMachineController();

  final List<String> _symbols = [
    '🍒',
    '🍋',
    '7️⃣',
    '💎',
    '⭐',
    '🔔',
  ];

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            // Slot Machine Widget
            SlotMachineWidget(
              primaryColor: Colors.redAccent,
              showInnerFrame: true,
              width: 300,
              controller: _controller,
              symbols: _symbols,
              buttonText: 'SPIN',
              accentColor: Colors.red,
              // Add sound effects
              spinSoundAsset: 'sounds/spin.mp3',
              resultSoundAsset: 'sounds/win.mp3',
              onSpinStart: () {
                debugPrint('Spin started');
                setState(() {});
              },
              onResult: (results) {
                debugPrint('Spin result: $results');
              },
              onSpinEnd: () {
                debugPrint('Spin ended');
              },
            ),
          ],
        ),
      ),
    );
  }
}
0
likes
135
points
49
downloads

Documentation

API reference

Publisher

verified publisherkabyachalise.com.np

Weekly Downloads

A highly customizable slot machine widget for Flutter with smooth animations, beautiful skeuomorphic design, and sound support.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

audioplayers, flutter

More

Packages that depend on slot_machine_ui