themed
8.4.1, released 4 days ago by glasberg.dev
Define themes with const values and change them dynamically at runtime.
What it does
Allows developers to define themes using const ColorRef and TextStyleRef values that can still be updated dynamically. It also provides widgets and extensions to modify color properties like brightness, saturation, and hue.
AI-written summary of version 8.3.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to use const values for theme references in constructors and default parameters
- You need to change themes dynamically without relying exclusively on Theme.of(context)
- You want to apply color adjustments like brightness, saturation, or contrast to specific widgets or images
Skip it when
- You prefer sticking purely to Flutter's native ThemeData and Theme.of(context) architecture
- You are not using Flutter
Strengths
- Enables const theme references
- No need to pass context for accessing theme values
- Includes helpful color and text style extension methods and transformation tools
Weaknesses
- Doesn't completely replace Flutter's native ThemeData system, meaning integration can sometimes require additional boilerplate
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
Wrap your widget tree with the Themed widget above the MaterialApp.
static const myColor = ColorRef(Colors.white);
Container(
color: myColor,
child: const Text('Hello'),
);
Themed.currentTheme = {
myColor: Colors.blue,
};Alternatives
Packages that do the same job and could replace themed.
- 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 - flutter_font_picker
A Flutter widget that lets the user select a Google Font from a custom dropdown or screen.
74Compare - xdg_icons
XDG theme icons for Flutter.
62Compare