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

Dismiss function on Flushbar not working? #151

Open
renrique92 opened this issue Jul 31, 2020 · 1 comment
Open

Dismiss function on Flushbar not working? #151

renrique92 opened this issue Jul 31, 2020 · 1 comment

Comments

@renrique92
Copy link

renrique92 commented Jul 31, 2020

I been trying to make a dismiss button on the toast but is not working

Here is my code of my Factory:

static Flushbar toastFactory(ToastSettings settings) {
_flush = Flushbar(
messageText: settings.highlightedText != null
? RichText(
text: TextSpan(
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: FONT_BODY_SIZE,
),
text: settings.highlightedText,
children: [
TextSpan(
text: ' ${settings.message}',
style: TextStyle(
fontWeight: FontWeight.normal,
fontSize: FONT_BODY_SIZE,
)),
],
),
)
: HFText(settings.message),
duration: settings.duration,
icon: settings.icon,
flushbarPosition: settings.position,
backgroundColor: settings.type.color,
dismissDirection: _dismissDirection(settings.position),
shouldIconPulse: false,
borderRadius: 4,
onStatusChanged: (status) {
if (status == FlushbarStatus.DISMISSED) {
_busy = false;
if (settings.dismissCallback != null) settings.dismissCallback();
}
},
flushbarStyle: _toastStyle(settings.position),
mainButton: HFIconButton.streched(
icon: HeroFinder.hf_close,
onPressed: () => _flush.dismiss(),
),
onTap: (flushbar) {
flushbar.dismiss();
},
);
return _flush;
}

I tried to use the onTap and nothing happended

@benPesso
Copy link

benPesso commented Oct 1, 2020

You're referencing the wrong object in your dismiss call (missing an underscore):

onTap: (flushbar) {
  flushbar.dismiss(); // should be: _flushbar.dismiss(); 
},

Next time, by the way, please use backward quotes (`) - or three backward quotes (```) for a code block - to make your code more readable when posting an issue.

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