diff --git a/lib/src/widgets/buttons/_button.dart b/lib/src/widgets/buttons/_button.dart index e231b7c..33f113f 100644 --- a/lib/src/widgets/buttons/_button.dart +++ b/lib/src/widgets/buttons/_button.dart @@ -136,24 +136,19 @@ class NeuButtonState extends State @override Widget build(BuildContext context) { - return InkWell( - onTap: () { - var doOnPressedAction = () => { - if (widget.onPressed != null) {widget.onPressed!()} - }; - - if (widget.enableAnimation) { - // do the on pressed action after the - // first part of animation - _controller.forward().then((value) { - doOnPressedAction(); - _controller.reverse(); - }); - } else { - // do on pressed action without any - // animation - doOnPressedAction(); - } + return GestureDetector( + // first part of animation + onTapDown: (details) { + _controller.forward(); + }, + // second part of animation and perform action + onTapUp: (details) { + _controller.reverse(); + widget.onPressed!(); + }, + // end animation if user cancel the tap + onTapCancel: () { + _controller.reverse(); }, child: AnimatedBuilder( animation: _animation,