easy_dynamic_theme 2.3.1
easy_dynamic_theme: ^2.3.1 copied to clipboard
Automatically get your OS defined Theme (Dynamic), force your prefered one (Light / Dark) and persist your choice in the device.
import 'package:flutter/material.dart';
import 'package:easy_dynamic_theme/easy_dynamic_theme.dart';
import 'theme.dart';
import 'home.dart';
void main() async {
runApp(
EasyDynamicThemeWidget(
child: const MyApp(),
),
);
}
class MyApp extends StatelessWidget {
final String title = 'EDT - Example';
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: title,
debugShowCheckedModeBanner: false,
theme: lightThemeData,
darkTheme: darkThemeData,
themeMode: EasyDynamicTheme.of(context).themeMode,
home: MyHomePage(
title: title,
),
);
}
}