Skip to content

A easiest way to fulfill and control slot machine by flutter

License

Notifications You must be signed in to change notification settings

cia1099/slot_machine_roller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slot Machine Roller

The easiest way to control slot machine.
You just use setState to pass to target parameter to deterministic value to stop rolling.
Otherwise pass null to target parameter to start rolling until no null.

Here is the demo page.

Features

  • Easy way to start/stop rolling.
  • Customized build items in roller.
  • Deterministic value to stop in anytime.
  • The rolling animation involved damping.
  • Enable rolling delay at start time.
  • With up or down rolling direction.

Getting started

flutter pub add slot_machine_roller

Usage

You can see example for more details.

SlotMachineRoller(
    height: 170,
    width: 300,
    delay: Duration(seconds: 1)
    reverse: true,
    target: target,
    itemBuilder: (e) => Container(
        margin: EdgeInsets.symmetric(vertical: 10),
        height: 150,
        width: 150,
        alignment: Alignment.center,
        decoration: BoxDecoration(
            shape: BoxShape.circle, color: Colors.blue),
        child: Text(
            '$e',
            style: Theme.of(context)
                .primaryTextTheme
                .headlineLarge,
        ),
    )),
// To stop roller and suspend 4
setState(){
    target = 4;
}
// To start rolling until deterministic target
setState(){
    target = null; 
}

Please Note the height of item should as equal as the height of SlotMachineRoller. Because we expect the view only one item in roller.

Additional information

The assets images are referred from
https://github.com/josex2r/jQuery-SlotMachine.

About

A easiest way to fulfill and control slot machine by flutter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published