Skip to content

How can i disable tabs? #94

@Vuuux

Description

@Vuuux

Giving that my app is using a same GNav navigator for guest and logged in users, I want to limit guest's access to my app by disabling some nav tabs (grey out icon, disable onPress). But even if I didn't change the _selectedIndex, the navigator still switched the tabs.
I see that in your gnav.dart code there is no way to prevent switching tab:

                      onPressed: () {
                        if (!clickable) return;
                        setState(() {
                          selectedIndex = widget.tabs.indexOf(t);
                          clickable = false;
                        });

                        t.onPressed?.call();

                        widget.onTabChange?.call(selectedIndex);

                        Future.delayed(widget.duration, () {
                          setState(() {
                            clickable = true;
                          });
                        });
                      },

Can we add a disable state for GButton?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions