π change_theme_er - Theme Changer for Flutter
π A high-performance, customizable theme changer package for Flutter.
π Smooth transitions, Bloc-powered state management, and GetIt dependency injection.
π πΈ Demo & Screenshots
Light Mode | Dark Mode |
---|---|
![]() |
![]() |
π Features
β Smooth theme transitions with animation
β Bloc-powered for optimized performance
β GetIt for dependency management
β Hive for instant theme persistence
β Supports Light/Dark mode with smooth transitions
β Highly customizable UI
π Installation
dependencies:
change_theme_er: latest_version
Then run:
flutter pub get
π Usage
1οΈβ£ Initialize Dependencies
import 'package:change_theme_er/change_theme_er.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await setupLocator();
}
2οΈβ£ Use Bloc for Theme Management
BlocProvider(
create: (context) => sl<ThemeBloc>()..add(LoadTheme()),
child: MyApp(),
);
3οΈβ£ Animated Theme Switch Button
GestureDetector(
onTap: () {
context.read<ThemeBloc>().add(ToggleTheme());
},
child: CustomSwitchButton(),
);
π API Reference
Method | Description |
---|---|
setupLocator() |
Initializes Hive and GetIt dependencies |
ThemeBloc |
Manages theme state using Bloc |
ToggleTheme() |
Toggles between Light and Dark mode |
π File Structure
The change_theme_er
package follows a Clean Code architecture:
change_theme_er/
βββ lib/
β βββ change_theme_er.dart
β βββ src/
β β βββ core/
β β β βββ di/
β β β β βββ service_locator.dart
β β β βββ theme_repository.dart
β β βββ presentation/
β β β βββ bloc/
β β β β βββ theme_bloc.dart
β β β β βββ theme_event.dart
β β β β βββ theme_state.dart
βββ example/
β βββ lib/main.dart
βββ pubspec.yaml
βββ README.md
βββ CHANGELOG.md
βββ LICENSE
π How It Works
The package uses Bloc for state management and Hive for persistent storage.
Hereβs how the theme switching works under the hood:
1οΈβ£ User taps the switch button.
2οΈβ£ Bloc event ToggleTheme()
is triggered.
3οΈβ£ Bloc updates the state (Light Mode β Dark Mode
).
4οΈβ£ Hive saves the user's theme preference for future sessions.
π Roadmap
π― Upcoming Features:
π Contribution
We welcome contributions!
π For feature requests or bug reports, open an issue.
π License & Contact
This project is licensed under Pharrax Software - YILMAZ ER.
For licensing information, please contact:
π© Email: yilmazer@pharraxsoftware.com
π Support the Project
If you like this package, please give it a β on GitHub and like it on pub.flutter-io.cn!
π Your support helps us improve and add more features.
"""
Provide download link
https://github.com/Developeryilmaz/change_theme_er