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

Why not use overlay for flushbar #54

Closed
ryanhz opened this issue May 29, 2019 · 6 comments
Closed

Why not use overlay for flushbar #54

ryanhz opened this issue May 29, 2019 · 6 comments
Labels
enhancement New feature or request priority This issue is a priority and is currently being worked on

Comments

@ryanhz
Copy link

ryanhz commented May 29, 2019

It is fantastic to have flushbar, but it really mangles with the route state if you need to show flushbar at the same time you want to pop back to another page, which can also happen when user tap the back button on the phone.

@AndreHaueisen
Copy link
Owner

Hi @huzhiren
Can you be more specific? What do you have in mind when you say overlay? Maybe I missed a possible solution here.

I don't know if you are already using it but Flushbar returns a Future that completes when it is fully dismissed. It can help you in the example you gave me.

@AndreHaueisen AndreHaueisen added the waiting for user response Further information is requested label May 31, 2019
@AndreHaueisen
Copy link
Owner

See issue

@AndreHaueisen AndreHaueisen added enhancement New feature or request priority This issue is a priority and is currently being worked on and removed waiting for user response Further information is requested labels Jun 1, 2019
@AndreHaueisen
Copy link
Owner

After testing it, I have discarded using Overlay widget. The overlay does not stay on the screen once the route gets popped so it brings no benefit once the back button is pressed.

@diegoveloper
Copy link

diegoveloper commented Feb 14, 2020

+1 to this issue , it would be great if Flushbar allow us using Overlay instead of the Navigator

@deakjahn
Copy link

deakjahn commented Mar 10, 2020

Yes, a use case for you, because I'm thinking about how to solve this just now. :-)

The user does some operation that is confirmed with a Flushbar. While the Flushbar is still visible, the user swipes open the Drawer and selects an entry. The handler for that entry starts with a

Navigator.pop(context);

as usual, to dismiss the open drawer before starting its own work. However, as the Fushbar is still visible on screen, this pop doesn't work, the drawer isn't dismissed.

A workaround would be, of course, to have a static function, something like Flushbar.dismissAll() to immediately dismiss any visible bars without actually keeping reference to them.

@deakjahn
Copy link

Just for reference, this is how I solved it. Create your own file with appropriate helper routines:

Flushbar _flushBar;

void successBar(BuildContext context, {String message, String title}) {
  _flushBar = Flushbar(
    title: title,
    message: message,
    ...
  );
  _flushBar.show(context);
}

void dismissBar() {
  if (_flushBar?.isShowing() ?? false) _flushBar.dismiss();
}

and call dismissBar() whenever and wherever you have the chance of a flushbar being present (eg. before you pop a Drawer from the Navigator).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority This issue is a priority and is currently being worked on
Projects
None yet
Development

No branches or pull requests

4 participants