πŸŒ“ change_theme_er - Theme Changer for Flutter

-- Pub Version GitHub Repo stars License: MIT GitHub issues Last Commit

πŸš€ 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:

  • Custom Animated Transitions
  • Adaptive Themes based on Time of Day
  • Material You Support (Dynamic Colors)

πŸ“Œ 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. """

https://github.com/Developeryilmaz/change_theme_er

Languages Used

Language Breakdown

Libraries

change_theme_er