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

Issue with snackBarTheme #7

Closed
sloosh opened this issue Sep 28, 2020 · 6 comments
Closed

Issue with snackBarTheme #7

sloosh opened this issue Sep 28, 2020 · 6 comments

Comments

@sloosh
Copy link

sloosh commented Sep 28, 2020

Hi,
Changing the snackBarTheme in the themes as no effect... for example it is impossible for me to change color from text or background.
Seems you got the same issue since you have hard coded SnackBar color in your controller code.
Do you know why it doesn't work ?
Thanks

@delay
Copy link
Owner

delay commented Sep 28, 2020

The snackbar is currently using GetX snackbars. When I worked on the theme part of the code I was using regular flutter snackbars. I just hard coded the GetX ones with some default colors because I added GetX into my package at a later time. You could probable just edit the code and use the snackbar theme colors for GetX snackbars.

@sloosh
Copy link
Author

sloosh commented Sep 28, 2020

Hmmm... ok but do you know why changing the SnarBarTheme colors doesn't change the appearance of the GetX snackbars ?
Thanks.

@delay
Copy link
Owner

delay commented Sep 28, 2020

Because SnackBarTheme is for regular flutter snackbars. GetX uses their own implementations of snackbars. This has some positives like not having to pass context into snackbars when you want to call them so you can better separate your code from your UI. However there are a few negatives like not being able to call the SnackBarTheme colors. Now you could probably rewrite my functions to pass in the context and use something like: Theme.of(context).backgroundColor or you could just hardcode whatever color you want them to be. I took the easy way and just hardcoded them.

@sloosh
Copy link
Author

sloosh commented Sep 28, 2020

Thanks I got it, but I find a bit weird it couldn't call the SnackBarTheme.
I simply used Get.theme.snackBarTheme to retrieve the corresponding properties...

@delay
Copy link
Owner

delay commented Sep 29, 2020

Thanks for the info... I will update my starter. I didn't know GetX had a way to call theme properties. Thanks for letting me know about it!

@delay
Copy link
Owner

delay commented Sep 29, 2020

It is fixed now! Thanks @sloosh !

@delay delay closed this as completed Sep 29, 2020
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