Skip to content

Instantly share code, notes, and snippets.

@manojeeva
Created January 10, 2020 05:41
Show Gist options
  • Save manojeeva/9f513a79c19ad826d768ba11ccc4bf1d to your computer and use it in GitHub Desktop.
Save manojeeva/9f513a79c19ad826d768ba11ccc4bf1d to your computer and use it in GitHub Desktop.
Changing Tab
void onChangeTab(int index) {
if (itemWidth == null) itemWidth = MediaQuery.of(context).size.width / 5;
setState(() {
selectedIndex = index;
});
var nextPos = index * itemWidth + 10;
pivotPoints[0] = pivotPoints[2];
double px = (nextPos + pivotPoints[2].dx) / 2;
animationController.reset();
pivotPoints[1] = Offset(px, -150);
pivotPoints[2] = Offset(nextPos, -25);
animationController.forward();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment