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

Store setThemeData value in the shared preferences. #16

Closed
hupo376787 opened this issue Jan 20, 2019 · 8 comments
Closed

Store setThemeData value in the shared preferences. #16

hupo376787 opened this issue Jan 20, 2019 · 8 comments

Comments

@hupo376787
Copy link

As when changing the brightness with setBrightness, it is additionally stored in the shared preferences.

So I think it's necessary to do the same for setThemeData

@sjmcdowall
Copy link
Contributor

Why? Themedata is (should be) generated (and regenerated) when the Brightness is set. Generally via a function call in the "data:" option. So I don't see how this is needed?

@Aqluse
Copy link

Aqluse commented Feb 3, 2019

@sjmcdowall You're right, but there could be more than 2 themes, so better to be able to handle this case

@sjmcdowall
Copy link
Contributor

I am not sure what you mean -- how can there be more than 2 themes? And in any event -- the logic (whatever it is) in the data: function should / needs to be able to regenerate the theme given the input.

@Aqluse
Copy link

Aqluse commented Feb 3, 2019

@sjmcdowall I mean in-app themes, I already saw apps that have more than 2 themes though

Google limit theme diversity for some reason, required MaterialColor in ThemeData and applience of all of these values is some hell of a magic

@hupo376787
Copy link
Author

Hi, some apps may have several color themes for users to select.
_20190207205926

@Norbert515
Copy link
Owner

IMO having more than just the brightness saved to shared preferences makes sense.
One questions that need to be addressed is:

  • How is storage managed/ what is stored?

@sjmcdowall
Copy link
Contributor

@Norbert515 -- Excellent questions ... and I don't think easy to answer .. without opening up a "can of worms" as to the interface into DynamicTheme as to what to save .. the how? Probably some JSON string of the other theme elements that are desired to be saved.. but this isn't needed for everyone so it somehow needs to be optional. For example, in our app we can easily (because there aren't any options besides Dark/Light) re-create our entire ThemeData in our Theme generator function just based on the Dark/Light flag. We actually wouldn't want anything to be saved since if we wanted to change the theme logic -- we would want it to be dynamic with next download/launch and not be saved..

But -- for more complex Themes that need additional input .. I would somehow thing about storing the minimum "flags" needed to be able to recreate the ThemeData from a function instead of trying to save the actual ThemeData itself?

@Norbert515
Copy link
Owner

What I also noticed - a lot of people come up with their own theme-management system because the MaterialTheme doesn't provide the flexibility/ ease of use.

I thought about making a package which helps set up a custom theme system (managing the InhertitedWidget, lerping and accessing it) a couple of weeks ago (maybe via code generation or something else).

I think having something like that combined with this dynamic theme package would make a lot of sense because you'd be able to specifically choose which properties should be changeable/ saved.

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

4 participants