Features
- It is use to switch the between light and dark theme in the app.
- Used GetX State Management tool in it.
Getting started
- Add the dependency in the pubspec.yml
- Add the GetX dependency in the pubspec.yml
Usage
class MyApp extends StatelessWidget {
MyApp({super.key});
final themeController = Get.put(ThemeController());
@override
Widget build(BuildContext context) {
return Obx(() => MaterialApp(
theme: themeController.isDarkMode.value ? AppTheme.darkTheme : AppTheme.lightTheme,
home: HomePage(),
)
);
}
}