shake_tune

This is a simple plugin that provides a wdiget randomizer while shaking the phone.

IMAGE ALT TEXT HERE

Features

  • Shake Detection
  • Customizable Actions
  • Randomization
  • Configuration Options

Rapid Start

For rapid start use this code:

ShakeTune(
  children: [
    Text('Widget 1'),
    Text('Widget 2'),
    Text('Widget 3'),
  ]
)

How to use full functionality

Just use this wdget as follows:

ShakeTune(
  probabilities: const [0.2, 0.2, 0.2, 0.2, 0.2],
  alwaysChooseDifferentElement: true,
  firstElementShownOnlyOnce: true,
  callback: () {
    setState(() {
      animationFlag = !animationFlag;
    });
  },
  children: [
    prizeItem('Shake your phone', Icons.edgesensor_high_rounded),
    prizeItem('Car', Icons.directions_car_rounded),
    prizeItem('House', Icons.house_rounded),
    prizeItem('100 ₽ balance top up', Icons.currency_ruble),
    prizeItem('Console', Icons.games_rounded),
    prizeItem('- 7000 ₽ fire alarm penalty', Icons.fire_extinguisher_rounded),
  ]
)

Full parameters list:

  • children array - all results that randomizer may give (must not be null)
  • probabilities array - probabilities for each element in children (the length shall be equal to length of the children array, and the sum of all elements shall be equal to one)
  • callback - call when phone shook
  • firstElementShownOnlyOnce - property that defines if first element shows only on first start (before shake)
  • alwaysChooseDifferentElement - property that defines if we should choose different element on every shake

License

MIT License