curved_navigation_bar icon indicating copy to clipboard operation
curved_navigation_bar copied to clipboard

the navigation is not re-rendering when one item changes or when called

Open kristijorgji opened this issue 2 years ago • 0 comments

I have two issues with this library, in priority order are: 1 even if _buildNavigation method is called I can see "i am re-rendering" being printed but the items don't change. 2 If one of the items is streambuilder or blocbuilder and is re-rendered the full navigation does not re-render.

I can fix issue 1 with one ugly solution by providing always a random key, like this: key: Key(randomInt(0, 10000)) This will force the navigation to rerender and do what i want to do but will break my integration tests that find the navigation by id.

Widget _buildNavigation() {
print(' i am re-rendering');

return CurvedNavigationBar(
      key: HomePageKeys.bottomNavigationMenu,
      onTap: _onItemTapped,
      index: _currentIndex,
      height: 40,
      color: AppColors.Black,
      backgroundColor: backgroundColor,
      buttonBackgroundColor: AppColors.Primary,
      animationDuration: const Duration(milliseconds: 300),
      animationCurve: Curves.easeOutCubic,
      items: <Widget>[
        StreamBuilder(
            stream: stream,
            builder: (context, snapshot) {
              return Text(snapshot.data);
              );
            }),
      ],
    );
}

kristijorgji avatar Jan 31 '23 16:01 kristijorgji