tako_dynamic_theme 0.0.2 tako_dynamic_theme: ^0.0.2 copied to clipboard
A Flutter package for changing theme at a snap with persisting into the shared preferences. It is suitable for supporting multiple themes other than light and dark.
Tako Dynamic Theme #
Demo #
Getting started #
- Add
tako_dynamic_theme
to your pubspec.yaml.
dependencies:
flutter:
sdk: flutter
tako_dynamic_theme: x.y.z
- 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