-
-
Save afonsocraposo/80f51fb90dae05078be008b2ae264a56 to your computer and use it in GitHub Desktop.
_setCurrentIndex & _triggerAnimation
This file contains 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
_setCurrentIndex(int index) { | |
// if we're actually changing the index | |
if (index != _currentIndex) { | |
setState(() { | |
// change the index | |
_currentIndex = index; | |
}); | |
// trigger the button animation | |
_triggerAnimation(); | |
// scroll the TabBar to the correct position (if we have a scrollable bar) | |
_scrollTo(index); | |
} | |
} | |
_triggerAnimation() { | |
// reset the animations so they're ready to go | |
_animationControllerOn.reset(); | |
_animationControllerOff.reset(); | |
// run the animations! | |
_animationControllerOn.forward(); | |
_animationControllerOff.forward(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment