Skip to content

Instantly share code, notes, and snippets.

@Afonsocraposo

Afonsocraposo/main.dart Secret

Last active Aug 11, 2019
Embed
What would you like to do?
_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