theme_provider
0.6.0, released 4 years ago by an unverified publisher
Easy to use and customizable Theme Provider with persistence and dynamic switching.
What it does
Provides app color schemes throughout the widget tree, automatically rebuilds the UI dynamically when themes change, and optionally persists user theme preferences to disk using shared preferences.
AI-written summary of version 0.6.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want a straightforward way to manage and persist light/dark or custom themes in a Flutter app.
- You need to provide theme-specific options alongside your theme data.
Skip it when
- You are already using a state management solution like Riverpod or Bloc that handles theme state directly.
- You require complex reactive system theme listening out of the box without manual setup callbacks.
Strengths
- Easy setup for multi-theme apps with custom theme IDs and descriptions
- Built-in disk persistence via shared preferences
- Includes helper widgets like theme cycling icon buttons and selection dialogs
Weaknesses
- Does not dynamically listen to system theme changes automatically out of the box on start without custom callbacks
- Requires wrapping routes or the material app with specific consumer widgets
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
ThemeProvider(
child: ThemeConsumer(
child: Builder(
builder: (themeContext) => MaterialApp(
theme: ThemeProvider.themeOf(themeContext).data,
title: 'Material App',
home: HomePage(),
),
),
),
);Alternatives
Packages that do the same job and could replace theme_provider.
- provider
If you prefer a general-purpose state management solution that can also handle theme state.
81Compare - riverpod
For a robust, compile-safe state management approach to handle application themes.
99Compare - bloc
If your app is already architected around BLoC and you want event-driven theme changes.
92Compare
Works with
Packages commonly used together with theme_provider: ones it builds on, ones built on it, and its own family.