Adaptive Theme Manager is a Flutter package that provides an easy way to manage themes dynamically with support for Material 3, custom text themes, app bars, and button themes.
Features
- Supports both light and dark themes.
- Uses Material 3 design.
- Customizable text themes, app bars, and buttons.
- Easily integrates into any Flutter application.
Installation
Add this to your package's pubspec.yaml file:
dependencies:
adaptive_theme_manager: latest_version
Then, run:
flutter pub get
Usage
Wrap the AdaptiveThemeProvider widget around your main app or any specific part of the widget tree you want to manage themes for:
Basic Usage
import 'package:flutter/material.dart';
import 'package:adaptive_theme_manager/adaptive_theme_manager.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
final themeManager = AdaptiveThemeManager(
primaryColor: Colors.blue,
brightness: Brightness.light,
);
return AdaptiveThemeProvider(
themeManager: themeManager,
child: Scaffold(
appBar: AppBar(title: const Text('Adaptive Theme Manager Example')),
body: const Center(child: Text('Theme applied!')),
),
);
} }
Custom Theme Settings
For full customization, use the properties like customTextTheme, customAppBarTheme, and customButtonTheme:
AdaptiveThemeManager(
primaryColor: Colors.green,
brightness: Brightness.dark,
customTextTheme: TextTheme(
bodyLarge: TextStyle(fontSize: 18, color: Colors.white),
),
);
License This project is licensed under the MIT License - see the LICENSE file for details.
Contributions Contributions are welcome! Please feel free to submit a Pull Request.