delay / flutter_starter

MIT License
422 stars 146 forks source link

Issue with snackBarTheme #7

Closed sloosh closed 4 years ago

sloosh commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

delay commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

It is fixed now! Thanks @sloosh !