Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

animated_theme_switcher

animated theme switcher with flutter like telegram.

this library starts from peyman’s stackoverflow question how-to-add-animation-for-theme-switching-in-flutter

animated_theme_switcher

getting started

add animated_theme_switcher: “^2.0.1” in your pubspec.yaml dependencies.

dependencies:
 animated_theme_switcher: "^2.0.1"

how to use

import the following package in your dart file

import 'package:animated_theme_switcher/animated_theme_switcher.dart';

wrap materialapp with themeprovider widget, as it has shown in the following example:

  themeprovider(
      inittheme: inittheme,
      builder: (context, mytheme) {
        return materialapp(
          title: 'flutter demo',
          theme: mytheme,
          home: myhomepage(),
        );
      }),
    ),

but if all you want is to provide a theme, use as follows:

  themeprovider(
      inittheme: inittheme,
      child: somecoolpage(),
    ),

wrap the screen where you whant to make them switch with themeswitchingarea widget, as it has shown in the following example:

    themeswitchingarea(
      child: builder(builder: (context) {
        return ...,
      },
    );

wrap every switcher with themeswitcher builder, and use themeswitcher.of(context).changetheme function to switch themes;


    themedata newtheme = themedata(
      primarycolor: colors.amber
    );
    ...
    themeswitcher(
      builder: (context) {
        ...
        ontap: () => themeswitcher.of(context).changetheme(
          theme: newtheme,
          reverseanimation: false // default: false 
        );
        ...
      },
    );

use optional named parameter clipper to pass the custom clippers.

    ...
    themeswitcher(
      clipper: themeswitcherboxclipper(),
      builder: (context) {
        ...
      },
    );

use optional named parameter clipper to pass the custom clippers.

    ...
    themeswitcher(
      clipper: themeswitcherboxclipper(),
      builder: (context) {
        ...
      },
    );

Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Top