Last updated:
0 purchases
animated random button
Animated Random Button Flutter Package #
The Animated Random Button Flutter Package provides a set of four animated buttons that generate random values for different scenarios. The buttons included are:
Coin Button: Gives random output of "Odd" or "Even" when pressed.
Dice Button: Gives a random value between 1 and 6 when pressed by default, but range can be changed.
Spinning Wheel Button: Gives a random passed color when pressed.
Magic 8-Ball Button: Gives a random answer like a classic magic 8-ball toy when pressed.
Installation #
Add the following line to your pubspec.yaml file:
dependencies:
animated_random_button: ^1.0.2
copied to clipboard
Then run flutter pub get in your terminal to install the package.
Usage #
Import the package in your Dart file:
import 'package:animated_random_button/animated_random_button.dart';
copied to clipboard
Coin Button #
The Coin button can be used as follows:
CoinButton(
onPressed: () {},
radius: 100,
coin: Coins.Cent,
duration: const Duration(seconds: 2),
),
copied to clipboard
You can add custom coins:
class newCoins extends Coins {
static const myFancyCoin = Coins(Coin('assets/FancyCoinHead.png','assets/FancyCoinTail.png'));
newCoins(super.value);
}
copied to clipboard
Dice Button #
The Dice button can be used as follows:
BouncingDiceButton(
start: 1, // by default
end: 6, // by default
duration: Duration(milliseconds: 500),
onPressed: () {
print("hello");
},
),
copied to clipboard
Spinning Wheel Button #
The Spinning Wheel button can be used as follows:
RandomColorWheel(
colors: const [
Colors.black,
Colors.amber,
Colors.black12,
Color(0xFF9D53CC),
],
size: 100,
onPressed: () {
print("Wheel is spinning");
},
duration: const Duration(seconds: 1),
waitForAnimation: false,
),
copied to clipboard
Magic 8-Ball Button #
The Magic 8-Ball button can be used as follows:
Magic8Ball(
radius: 100,
shakeDistance: 15,
numberOfShakes: 10,
durationOfShake: Duration(milliseconds: 100),
answers: ["yes", "no"], // default answers can be used
),
copied to clipboard
Customization #
You can change duration of animation, change sample and size of button.
Example #
For a more comprehensive example of how to use the Animated Random Button package, check the example folder provided in the package.
License #
This package is open-source and available under the MIT License. See the LICENSE file for more information.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.