Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotchBottomBarController jumpTo cause of no animation #26

Closed
aidenn207 opened this issue Apr 15, 2024 · 2 comments
Closed

NotchBottomBarController jumpTo cause of no animation #26

aidenn207 opened this issue Apr 15, 2024 · 2 comments

Comments

@aidenn207
Copy link

NotchBottomBarController().jumpTo(index) still work to navigate to change to index of bottomBarItems.
But it's no animation when i call jumpTo() function of NotchBottomBarController.
If i don't use this jumpTo() function, animation work well

Please help to fix, because i have usecase that i wanna jumpTo specify index after i receive index number from bloc

@abrarmalekji345
Copy link
Contributor

@aidenn207 it seems you are trying to call jumpTo from the state of the bloc, but it is already being called when the user clicks on the bottom bar item. so I propose to store the bottom-bar index separately and call jumpTo only if the index is changed. please let me know if you have any query
Thanks.

abrarmalekji345 pushed a commit that referenced this issue Apr 22, 2024
- Added argument of `circleMargin` and `topMargin` in bottom navigation bar
@aidenn207
Copy link
Author

aidenn207 commented Apr 23, 2024

Thank @abrarmalekji345 for reply.
I call jumpTo after state of the bloc has been changed. The bloc event is called by clicking on a button from other screen.
I mean users dont click on the bottom bar item.

  • There's only missing animation when user click on the bottom bar item index == 1.
  • If calling jumpTo() on bloc listener, animation works
    There's something conflict, i cannot figure out

2024-04-23_09-53

Below is the code for more detail:
BlocConsumer<MainBloc, MainState>(listener: (context, state) { if (state.bottomBarIndex == 1) { _controller.jumpTo(state.bottomBarIndex); } }, builder: (BuildContext context, state) { return AnimatedNotchBottomBar( onTap: (index) { context.read<MainBloc>().add(BottomBarChangeEvent(index: index)); }, notchBottomBarController: _controller, color: context.colors.white, notchColor: context.colors.white, durationInMilliSeconds: 300, removeMargins: false, showLabel: false, kBottomRadius: 28, kIconSize: 24, elevation: 1, shadowElevation: 5, showShadow: true, showBottomRadius: true, bottomBarItems: [ BottomBarItem( inActiveItem: ImageView(ImageNamed.icHomeGray, padding: const EdgeInsets.all(staticIconPadding)), activeItem: Lottie.asset(ImageNamed.icAnimatedHome), itemLabel: getString().home), BottomBarItem( inActiveItem: ImageView(ImageNamed.icLocationGray, padding: const EdgeInsets.all(staticIconPadding)), activeItem: Lottie.asset(ImageNamed.icAnimatedLocation), itemLabel: 'Booking'), BottomBarItem( inActiveItem: ImageView(ImageNamed.icUserGray, padding: const EdgeInsets.all(staticIconPadding)), activeItem: Lottie.asset(ImageNamed.icAnimatedUser), itemLabel: getString().account), ]); });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants