bounce_tap 1.0.2 bounce_tap: ^1.0.2 copied to clipboard
A great and efficacious flutter package to add an on-tap bounce animation on any flutter widget
- A great flutter and efficacious package for an on-tap bounce animation on any flutter widget
Usage #
To use this package, add bounce_tap
as a dependency in your pubspec.yaml file.
Demo #
Example #
- Import the library
import 'package:bounce_tap/bounce_tap.dart';
- In order to use this package, we just need to wrap the content with the widget
BounceTap
. - Only
child
,onTap
are mandatory in the widget. tapIntensity
is used to define how much the widget should scale down when pressed- Stronger is
tapIntensity
, stronger will the widget bounce. tapIntensity
,onTap
andduration
can havenull
in the widget. By defaultduration
is set to200 ms
.
BounceTap(
duration: Duration(milliseconds: 150),
onPressed: (){ YOUR_FUNCTION },
child: YOUR_WIDGET,
tapIntensity: TapIntensity.mid
)
Documentation #
BounceTap properties #
Name | Type | Default | Description |
---|---|---|---|
child | Widget |
required | child widget |
onTap | VoidCallback |
required | onTap event handler |
tapIntensity | TapIntensity |
TapIntensity.mid |
sets the intensity of the tap, if defines how hard you want the widget to bounce on tap |
duration | Duration |
Duration(milliseconds:250) |
sets the duration of the bounce animation |
onLongPressed | VoidCallback |
null |
onLongPress event handler |
tapDelay | int |
300 | how long the widget should wait before calling the onTap /onLongPress events handlers |
Now enjoy!
Refer to example folder and the source code for more information.
Acknowledgement #
- I would like to thank Mohsin for the inspiration for this library, which I think will be useful for Flutter community