-
-
Save afonsocraposo/e8e6da22b2ae3d0f3fcd581ca28b0099 to your computer and use it in GitHub Desktop.
_handleTabAnimation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// runs during the switching tabs animation | |
_handleTabAnimation() { | |
// gets the value of the animation. For example, if one is between the 1st and the 2nd tab, this value will be 0.5 | |
_aniValue = _controller.animation.value; | |
// if the button wasn't pressed, which means the user is swiping, and the amount swipped is less than 1 (this means that we're swiping through neighbor Tab Views) | |
if (!_buttonTap && ((_aniValue - _prevAniValue).abs() < 1)) { | |
// set the current tab index | |
_setCurrentIndex(_aniValue.round()); | |
} | |
// save the previous Animation Value | |
_prevAniValue = _aniValue; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment