Tako Dynamic Theme

Demo

demo

Getting started

  1. Add tako_dynamic_theme to your pubspec.yaml.
dependencies:
    flutter:
        sdk: flutter
    tako_dynamic_theme: x.y.z
  1. Run flutter pub get in the terminal.

Usage

This package use key-value to index the ThemeData.

You can wrap your app by TakoDynamicTheme widget.

void main() {
  runApp(
      TakoDynamicThemeWidget(
        themeMap: {
            "light": ThemeData.light(),
            "dark": ThemeData.dark(),
            "night": ThemeConfig.nightTheme // pre-defined ThemeData
        }, 
        fallbackTheme: ThemeData.light(), 
        child: const MyApp()));
}

You can change the theme by the following code inside widget.

TakoDynamicTheme.of(context).changeTheme(themeKey: "night"),

You can checkout the example in this repository.

cd example
flutter run

Libraries

tako_dynamic_theme