Skip to content
pubscout

stacked_themes

0.3.16, released 8 weeks ago by filledstacks.com

Manage multiple themes, dark mode, and theme persistence in Flutter applications.

$ flutter pub add stacked_themes
Source repository

What it does

It provides a ThemeManager, ThemeBuilder widget, and ThemeService to easily swap between multiple ThemeData configurations or toggle light and dark modes. It handles theme persistence using shared_preferences and includes status bar color updates.

AI-written summary of version 0.3.16, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to manage more than just a simple light and dark theme (multiple themes)
  • You want automatic persistence of the user's selected theme across app restarts
  • You are using the Stacked architecture and want a ThemeService for your view models

Skip it when

  • you prefer using Riverpod or Bloc for all state management including themes
  • You only need standard Flutter ThemeMode toggling without extra utilities

Strengths

  • Supports multiple themes beyond just light and dark
  • Built-in theme persistence via shared_preferences
  • Includes business logic access via ThemeService for ViewModels

Weaknesses

  • Tied to the Stacked ecosystem conventions
  • Adds several third-party dependencies for what can be done natively

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
7

Awaiting ThemeManager.initialise() in main function before running the app.

Future main() async {
  await ThemeManager.initialise();
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ThemeBuilder(
      builder: (context, regularTheme, darkTheme, themeMode) => MaterialApp(
        title: 'Flutter Demo',
        theme: regularTheme,
        darkTheme: darkTheme,
        themeMode: themeMode,
      ),
    );
  }
}

Alternatives

Packages that do the same job and could replace stacked_themes.

Works with

Packages commonly used together with stacked_themes: ones it builds on, ones built on it, and its own family.