Skip to content

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

@evanrich

Description

@evanrich

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions