Skip to content

Commit

Permalink
perf(home_page): prevent calling setState on the same navigation `i…
Browse files Browse the repository at this point in the history
…ndex`
  • Loading branch information
albertms10 committed Jan 6, 2022
1 parent 12b7651 commit 128f611
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/widgets/pages/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class _HomePageState extends State<HomePage> {
: _pageController.initialPage;

void _setNavigationIndex(int index) {
if (index == currentIndex) return;

setState(() => _pageController.jumpToPage(index));
}

Expand Down

0 comments on commit 128f611

Please sign in to comment.