Skip to content

Commit

Permalink
Add dark theme
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMedo committed Oct 29, 2024
1 parent a6fd046 commit 1f13e5f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
13 changes: 12 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,20 @@ class MyApp extends StatelessWidget {
return MaterialApp(
title: 'TODO Fall 2024',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.blueGrey,
brightness: Brightness.light,
),
useMaterial3: true,
),
darkTheme: ThemeData(
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.blueGrey,
brightness: Brightness.dark,
),
useMaterial3: true,
),
themeMode: ThemeMode.system,
home: Scaffold(
body: const RouterScreen(),
),
Expand Down
5 changes: 4 additions & 1 deletion lib/screen/details/details_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class _DetailsScreenState extends State<DetailsScreen> {

@override
Widget build(BuildContext context) {
final brightness = MediaQuery.of(context).platformBrightness;
final isDarkMode = brightness == Brightness.dark;

return PopScope(
onPopInvokedWithResult: (isPopped, _) {
if (isPopped && text != widget.todo.text) {
Expand Down Expand Up @@ -70,7 +73,7 @@ class _DetailsScreenState extends State<DetailsScreen> {
Navigator.of(context).pop();
},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red,
backgroundColor: isDarkMode ? Colors.red : Colors.deepOrange,
foregroundColor: Colors.white,
),
child: Text('Delete'),
Expand Down

0 comments on commit 1f13e5f

Please sign in to comment.