reactive_theme 1.0.1 copy "reactive_theme: ^1.0.1" to clipboard
reactive_theme: ^1.0.1 copied to clipboard

A simple pkg that changes thememode and persists it.

reactive_theme #

This package allows you to change theme of the app to light and dark mode and vice versa with the help of ReactiveThemer and ReactiveThemeBtn widgets.

Supports Android, iOS, Web, Mac, Linux and Windows.

What it can do #

You can easily toogle between light mode and dark mode using the ReactiveThemeBtn provided by this package.

You need not to worry about preserving the theme using shared_preferences as it already preserves the theme state of the app automatically using shared_preferences package.😎

Install it #

You can install simple_sizer using the below command:

 $ flutter pub add reactive_theme

Import it #

Now in your dart file you can use:

import 'package:reactive_theme/reactive_theme.dart';

Usage #

Wrap the MaterialApp widget with ReactiveThemer and nothing else.

⚠️ [Important]

ReactiveThemer must be the topmost widget in the widget tree

  ReactiveThemer(
      child: MaterialApp(
        title: 'Reactive Theme Demo',
        theme: ThemeData(
          colorScheme: ColorScheme.fromSeed(
              brightness: Brightness.light, seedColor: Colors.deepPurple),
          useMaterial3: true,
        ),
        darkTheme: ThemeData(
          colorScheme: ColorScheme.fromSeed(
              brightness: Brightness.dark, seedColor: Colors.deepPurple),
          useMaterial3: true,
        ),
        home: const HomePage(),
      ),
   );

Now you change toggle between dark and light mode easily from anywhere by using ReactiveThemeBtn Widget

  ReactiveThemeBtn()

reactive_theme has two more named constructors you can use if you don't like the default ReactiveThemeBtn, they are --

  //Helps you modify the original button
  ReactiveThemeBtn.editable()

and

  //Create your own button
  //It takes widget as a parameter
  //So , you can make anything you want to
  //like a switcher , floating action button etc...
  ReactiveThemeBtn.fromScratch()
7
likes
0
pub points
56%
popularity

Publisher

unverified uploader

A simple pkg that changes thememode and persists it.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, shared_preferences

More

Packages that depend on reactive_theme