Flutter tabcontroller index does not respond to changes in the tabbarview

just remove the condition :

  if (_controller.indexIsChanging) {

Because every time you start changing from previousIndex to the currentIndex, you rebuild the widget and your _controller.index is the same as your initial index.

This should work :

            _handleTabSelection() {
                  setState(() {
                    _currentIndex = _controller.index;
                  });
              }

Leave a Comment