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

Update examples in README #46

Closed
alexeyinkin opened this issue Nov 22, 2022 · 9 comments
Closed

Update examples in README #46

alexeyinkin opened this issue Nov 22, 2022 · 9 comments
Labels
documentation Improvements or additions to documentation

Comments

@alexeyinkin
Copy link

The first example is:

showTopSnackBar(
    context,
    CustomSnackBar.success(
      message:
          "Good job, your release is successful. Have a nice day",
    ),
);

This does not build because the first argument requires OverlayState instead of BuildContext.
Other examples should be updated too.

@vizhan-lanars vizhan-lanars added the documentation Improvements or additions to documentation label Nov 22, 2022
@wH1t3-l0tUs
Copy link

need another example pls

@rajesh-h
Copy link

rajesh-h commented Dec 7, 2022

I am also having same issue.
My example below worked fine till I upgraded flutter.

 showTopSnackBar(
        context,
        const CustomSnackBar.success(
          message: "Successful",
        ),
      );

Now I have below message.

The argument type 'BuildContext' can't be assigned to the parameter type 'OverlayState'.

@rajesh-h
Copy link

rajesh-h commented Dec 7, 2022

@alexeyinkin any workaround for this?

@longfit
Copy link

longfit commented Dec 15, 2022

Hi
So am I , facing this problem
The argument type 'BuildContext' can't be assigned to the parameter type 'OverlayState'.
when I upgraded to ^3.0.0

@lopb
Copy link

lopb commented Dec 19, 2022

Any news?

@flashelperz
Copy link

flashelperz commented Dec 23, 2022

Hi,
If you haven't resolve your problem yet.
There is the solution you should apply

OverlayState? state = Overlay.of(context);
if (state != null) { showTopSnackBar(state, _buildSnackBar(translatedMessage, snackBarType)); }

Just a simple precision

  • _buildSnackBar(...) here is a custom method i have written to display specific type of alert so for your work you can just continue using CustomSnackBar with their static methods (info, success...)

Hope this resolve your problem.

@lopb
Copy link

lopb commented Dec 23, 2022

@flashelperz , worked like a charm, thank you very much! :)

@vizhan-lanars
Copy link
Collaborator

I will update README.md and examples.
Thanks

@vizhan-lanars
Copy link
Collaborator

#58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

7 participants