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

Prevent flushbar show on child screen #45

Closed
trieuvi opened this issue Apr 23, 2019 · 5 comments
Closed

Prevent flushbar show on child screen #45

trieuvi opened this issue Apr 23, 2019 · 5 comments

Comments

@trieuvi
Copy link

trieuvi commented Apr 23, 2019

Hi,
I put my flushbar on the very top screen (Tabbar Screen) to listen to events from Socket.io. The flushbar works well on Tabbar Screen, but when I Navigator.push to next screen, call Chat Screen, the flushbar still showing. How can I dismiss flushbar on Chat Screen? Thanks in advance.

@AndreHaueisen
Copy link
Owner

Flushbar is a route, same as any other screen. It will be covered if you push another route above it. I'm not sure what you are doing there, but you can always dismiss it before calling the new screen.

@trieuvi
Copy link
Author

trieuvi commented Apr 24, 2019

@AndreHaueisen , my application is using Socket.io so whenever Socket.io emits messages to the app, Flushbar will show the messages on top, so I just put the Flushbar on a parent screen (Tabbar screen). I wanna show the Flushbar on some screens (List chats, list contacts), and not on some detail screens (Chat, User detail).
I wanna control the showing, just show on the parent (Tabbar screen), not on the child (Chat screen). Now the Flushbar is showing on both screens.

This is the map of screens:

Main --> Tabbar (Flushbar) --> List chats (show) || List contacts (show) || User (not) --> Chat detail (not)

Now i have to use callback function to tell Tabbar change state of showing Flushbar, but I don't think this is the best solution. Any ideas?

@AndreHaueisen
Copy link
Owner

Are you using the same BuildContext to show all of them?

@trieuvi
Copy link
Author

trieuvi commented Apr 24, 2019

Actually, I just call Flushbar.show() one time on Tabbar screen, in the listening function of Socket.io

@AndreHaueisen
Copy link
Owner

I don't think I can help you here. Flushbar is a route as any other. If you call show, it will push a route on top. If you want to select what screens to show, calling it from the root is not the right solution.

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