Skip to content

Instantly share code, notes, and snippets.

@afonsocraposo
Last active August 11, 2019 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save afonsocraposo/e8e6da22b2ae3d0f3fcd581ca28b0099 to your computer and use it in GitHub Desktop.
Save afonsocraposo/e8e6da22b2ae3d0f3fcd581ca28b0099 to your computer and use it in GitHub Desktop.
_handleTabAnimation
// 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