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

How can i disable tabs? #94

Open
Vuuux opened this issue Dec 14, 2023 · 2 comments
Open

How can i disable tabs? #94

Vuuux opened this issue Dec 14, 2023 · 2 comments

Comments

@Vuuux
Copy link

Vuuux commented Dec 14, 2023

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?

@sooxt98
Copy link
Owner

sooxt98 commented Dec 14, 2023

I think have to implement another attribute for Gnav, maybe an autoNavigateOnTap: false

@Vuuux
Copy link
Author

Vuuux commented Dec 14, 2023

I think have to implement another attribute for Gnav, maybe a autoNavigateOnTap: false

Thanks for your responding!

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