Last active
November 7, 2024 19:42
-
-
Save rohan20/b1a15c09bbb8d18c4caa9e8c41a108c0 to your computer and use it in GitHub Desktop.
Flutter button tap to shrink animation effect
Author
rohan20
commented
Jun 5, 2021
Make it better:
onTap: () {
// UX delight: Adding this delay let's the user see the tap
// animation before the tap action is performed instead of instantly
// performing the action. This is great in cases where the tap action
// triggers navigation. If we remove this delay, the app would navigate
// instantly and hence the user wouldn't be able to see the button
// animation in action.
Future.delayed(
const Duration(milliseconds: clickAnimationDurationMillis * 2),
() => widget.onTap?.call(),
);
_shrinkButtonSize();
_restoreButtonSize();
},
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment