### Wrap MaterialApp with ThemeProvider Source: https://github.com/kherel/animated_theme_switcher/blob/master/README.md Demonstrates how to wrap your `MaterialApp` widget with `ThemeProvider`. This setup initializes the theme and provides it to the entire application, enabling theme management and switching capabilities. ```dart ThemeProvider( initTheme: initTheme, builder: (context, myTheme) { return MaterialApp( title: 'Flutter Demo', theme: myTheme, home: MyHomePage(), ); }), ), ``` -------------------------------- ### Switch Themes using ThemeSwitcher.switcher Source: https://github.com/kherel/animated_theme_switcher/blob/master/README.md An alternative way to use `ThemeSwitcher` where the builder provides the `switcher` instance directly, simplifying the call to `switcher.changeTheme` for theme transitions. ```dart ThemeSwitcher.switcher( builder: (context, switcher) { ... onTap: () => switcher.changeTheme( theme: newTheme, ); ... }, ); ``` -------------------------------- ### Provide Theme with ThemeProvider (Simple) Source: https://github.com/kherel/animated_theme_switcher/blob/master/README.md Shows a simpler usage of `ThemeProvider` when the goal is solely to provide a theme to a specific child widget, without necessarily wrapping the entire `MaterialApp`. ```dart ThemeProvider( initTheme: initTheme, child: SomeCoolPage(), ), ``` -------------------------------- ### Switch Themes using ThemeSwitcher.of(context).changeTheme Source: https://github.com/kherel/animated_theme_switcher/blob/master/README.md Demonstrates the primary method for switching themes using `ThemeSwitcher.of(context).changeTheme`. This snippet shows how to define a new theme and apply it when an action (e.g., `onTap`) is triggered within the `ThemeSwitcher` builder. ```dart ThemeData newTheme = ThemeData( primaryColor: Colors.amber ); ... ThemeSwitcher( builder: (context) { ... onTap: () => ThemeSwitcher.of(context).changeTheme( theme: newTheme, isReversed: false // default: false ); ... }, ); ``` -------------------------------- ### Apply Custom Clipper to ThemeSwitcher Source: https://github.com/kherel/animated_theme_switcher/blob/master/README.md Shows how to use the optional `clipper` parameter in `ThemeSwitcher` to provide a custom animation clipper, allowing for unique and custom theme transition effects. ```dart ... ThemeSwitcher( clipper: ThemeSwitcherBoxClipper(), builder: (context) { ... }, ); ``` -------------------------------- ### Switch Themes using ThemeSwitcher.withTheme Source: https://github.com/kherel/animated_theme_switcher/blob/master/README.md Another alternative `ThemeSwitcher` constructor that provides both the `switcher` instance and the `current theme` to its builder. This is useful for toggling between themes based on the current theme's properties, like brightness. ```dart ThemeSwitcher.withTheme( builder: (context, switcher, theme) { ... onTap: () => switcher.changeTheme( theme: theme.brightness == Brightness.light ? darkTheme : lightTheme, ); ... }, ); ``` -------------------------------- ### Wrap Screen with ThemeSwitchingArea Source: https://github.com/kherel/animated_theme_switcher/blob/master/README.md Illustrates how to wrap the specific screen or widget where you intend to perform theme switching with the `ThemeSwitchingArea` widget. This defines the visual boundary for the theme transition animation. ```dart ThemeSwitchingArea( child: Builder(builder: (context) { return ..., }, ); ``` -------------------------------- ### Add animated_theme_switcher Dependency Source: https://github.com/kherel/animated_theme_switcher/blob/master/README.md Instructions to add the `animated_theme_switcher` package to your Flutter project's `pubspec.yaml` file, making it available for use in your application. ```yaml dependencies: animated_theme_switcher: "^2.0.8" ``` -------------------------------- ### Import animated_theme_switcher Package Source: https://github.com/kherel/animated_theme_switcher/blob/master/README.md The necessary import statement to include the `animated_theme_switcher` library in your Dart files, allowing access to its widgets and functions. ```dart import 'package:animated_theme_switcher/animated_theme_switcher.dart'; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.