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

dynamic_theme v2.0 #63

Open
TesteurManiak opened this issue Dec 8, 2021 · 1 comment · May be fixed by #64
Open

dynamic_theme v2.0 #63

TesteurManiak opened this issue Dec 8, 2021 · 1 comment · May be fixed by #64

Comments

@TesteurManiak
Copy link

TesteurManiak commented Dec 8, 2021

Hi @Norbert515,

First of all, thank you for your package, it helped me a lot for the first few Flutter projects I've made.

Your package seems to be unmaintained for a bit of time so I took the liberty of adapting your original work to make it fit my needs with the most recent releases of Flutter in one of my recent project. I've changed a bit the base behavior you've created to support ThemeMode instead of Brightness changes so the theme data can be updated with the light, dark or system values.

If you are interested I'd be glad to merge my modifications in your package, but note there is a few breaking changes (this is why I'm talking about a v2.0). You can already check out the code from my repository: https://github.com/TesteurManiak/ygo_collection_manager/blob/main/dynamic_theme/lib/src/dynamic_theme.dart

And here's a sample of how I'm using it in my project:

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<StatefulWidget> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return DynamicTheme(
      themedWidgetBuilder: (_, themeMode) {
        return MaterialApp(
          themeMode: themeMode,
          darkTheme: MyThemes.dark,
          theme: MyThemes.light,
          initialRoute: LoadingView.routeName,
          onGenerateRoute: generateRoute,
        );
      },
    );
  }
}

As you can see with the most recent version of Flutter you don't need to change the value of theme depending of the application Brightness anymore, it is the themeMode parameter that will define which of theme or darkTheme should be used.

So if you are interested I'd be glad to merge my code in your repo so everyone can beneficiate from it (also I could be helping solving the remaining opened issues).

Here's the issues that would be solved with this new code:

@guillempuche
Copy link

Make a pull request.

@TesteurManiak TesteurManiak linked a pull request Dec 14, 2021 that will close this issue
witchcraft2001 added a commit to witchcraft2001/dynamic_theme that referenced this issue Jan 15, 2022
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

Successfully merging a pull request may close this issue.

2 participants