easy_dynamic_theme
2.3.1, released 4 years ago by rlazom.dev
Automatically sync app theme with OS and persist user choice
What it does
EasyDynamicThemeWidget reads the system theme and applies it to your MaterialApp. It also lets you force light or dark mode and stores the preference with shared_preferences.
AI-written summary of version 2.3.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want your app to follow the device theme automatically
- You need to persist the user’s theme choice across launches
- You want quick, out‑of‑the‑box widgets to toggle theme
Skip it when
- You need fine‑grained control over multiple custom themes
- You are building a complex state‑management solution that requires custom logic
Strengths
- Simple API, no boilerplate
- Built‑in persistence
- Provides ready‑made toggle widgets
- Supports all Flutter platforms
Weaknesses
- Only supports light/dark, no custom theme switching
- No integration with advanced state‑management libraries
- Limited customization of the toggle widgets
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
```dart
import 'package:flutter/material.dart';
import 'package:easy_dynamic_theme/easy_dynamic_theme.dart';
void main() => runApp(
EasyDynamicThemeWidget(
child: MyApp(),
),
);
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) => MaterialApp(
theme: ThemeData.light(),
darkTheme: ThemeData.dark(),
themeMode: EasyDynamicTheme.of(context).themeMode,
home: Scaffold(body: Center(child: Text('Hello'))),
);
}
```Alternatives
Packages that do the same job and could replace easy_dynamic_theme.
- adaptive_theme
Dynamic light and dark theme switching with persistence for Flutter.
82Compare - random_color_scheme
Generates random light and dark Material Design color schemes respecting WCAG guidelines.
57Compare - xdg_icons
XDG theme icons for Flutter.
62Compare - reactive_theme
Toggles between light and dark mode and persists the preference.
40Compare
Works with
Packages commonly used together with easy_dynamic_theme: ones it builds on, ones built on it, and its own family.