flutter_theme_changer_erfan 0.0.1+5
flutter_theme_changer_erfan: ^0.0.1+5 copied to clipboard
A Flutter package that provides a widget for changing application themes. Includes both an expandable color picker and a dialog-based picker, ideal for implementing theme switching functionality in us [...]
Flutter Dynamic Theme Changer #
A Flutter package that allows you to easily change your app's theme color dynamically at runtime using Riverpod.
It provides both a full theme changer wrapper and two beautiful theme picker widgets!
β¨ Features #
- π¨ Dynamic primary color theme switching
- π§© Two ready-to-use theme picker widgets:
ThemeColorPickerWidget: An expandable color picker that can be placed anywhere(Great for floating).ThemeDialogButton: A convenient AppBar button that shows colors in a dialog. Great for all common use cases.
- π Allow users to pick from customizable color palettes
- π Built with Flutter Riverpod 2.0 (StateNotifier based)
- π― Simple API and easy integration
- βοΈ Fully customizable if needed
π₯ Theme Color Picker Demo
Above: Animated demo of ThemeColorPickerWidget.
π₯ Theme Dialog Button Demo
Above: Animated demo of ThemeDialogButton.
Getting started #
Add this to your package's pubspec.yaml file:
dependencies:
flutter_theme_changer_erfan: ^0.0.1+1
Then run flutter pub get to install the package.
π οΈ How to Use #
Option 1: Using ThemeColorPickerWidget (Expandable Picker) #
Place the color picker directly in your layout:
class HomeScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: ThemeColorPickerWidget(), // Expands to show colors when tapped
),
);
}
}
Option 2: Using ThemeDialogButton (Dialog Picker) #
Add a button to your AppBar that shows colors in a dialog:
class HomeScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('My App'),
actions: [
ThemeDialogButton(), // Shows color picker in a dialog
],
),
);
}
}
Basic Setup #
Wrap your app with ThemeChanger:
void main() {
runApp(
const ProviderScope(
child: ThemeChanger(
title: 'My App',
child: HomeScreen(),
),
),
);
}
π¨ Customizing Colors #
Both widgets accept custom colors:
// For ThemeColorPickerWidget
ThemeColorPickerWidget(
availableColors: [
Colors.teal,
Colors.indigo,
Colors.deepOrange,
Colors.cyan,
Colors.lime,
Colors.amber,
],
)
// For ThemeDialogButton (coming soon)
π¦ What's Inside #
| Widget/File | Purpose |
|---|---|
ThemeChanger |
Wraps your app with dynamic theming |
ThemeColorPickerWidget |
Expandable color picker that shows in-place |
ThemeDialogButton |
AppBar button that shows colors in a dialog |
ThemeNotifier + themeProvider |
Riverpod logic for managing theme color |
π² Example #
A full working example is available inside the /example folder.
To run the example locally:
flutter run --target=example/lib/main.dart
You'll see a floating color button β tap it, pick a color, and the app's theme changes instantly!
β All tests passed,including integration tests #
β All tests passed, including integration tests #

π Contributing #
Contributions are welcome! Feel free to open issues or submit pull requests if you'd like to help!
π₯ Author #
Erfan Alizada. Developed with β€οΈ using Flutter and Riverpod.
Additional information #
- For more examples, check out the example directory
- Report bugs on the issue tracker
- Contribute to the package on GitHub
π License MIT #
This project is licensed under the MIT License. See the LICENSE file for more details.