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

Question: How to not change selected index when another item is pressed? #202

Open
evanrich opened this issue Sep 23, 2023 · 0 comments
Open

Comments

@evanrich
Copy link

Is it possible to not change the selected index when the circle button is selected? for example:
image

bottomNavigationBar: ConvexAppBar(
            style: TabStyle.fixedCircle,
            height: 60,
            backgroundColor: Color.fromARGB(255, 26, 26, 26),
            activeColor: Colors.orange,
     
            items: [
              TabItem(icon: Icons.home, title: 'Home'),
              TabItem(icon: Icons.folder_shared, title: 'Models'),
              TabItem(icon: Icons.add, title: 'Add'),
              TabItem(icon: Icons.camera_indoor, title: 'Studios'),
              TabItem(icon: Icons.perm_media, title: 'Shoots'),
            ],
            onTap: (index) => {
              print('click $index'),
              // check if index is the add button, and if so don't do anything
              if (index < 2) {
                controller.jumpToPage((index))
              }  else if (index >2) {
                controller.jumpToPage((index - 1))
              }  else {
                print('Add button clicked'),
              }
            },
          )

If the 1st, 2nd, 4th or 5th bar icons are selected, I want them to stay selected, but allow the middle "+" button to create new items on the selected page, similar to the how venmo works:
image

the pay/request button in the middle launches a new page, but hitting "back" on your device still has home/cards/crypto/me selected. In otherwords ,the center icon should just function as a action item to do something, not change index on the bottom navigation bar. Thanks!

This is with the latest version of the convex_bottom_bar, fyi.

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

1 participant