From a498848f0a7520c650f17809e8a69cb60c15c5a6 Mon Sep 17 00:00:00 2001 From: Anton Schaich Date: Sun, 28 Dec 2025 17:27:18 +0100 Subject: [PATCH] add basic theme Light/Dark changing from device. --- lib/main.dart | 9 ++++++--- lib/utils/theme_data.dart | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 lib/utils/theme_data.dart diff --git a/lib/main.dart b/lib/main.dart index 0d84ef5..b3fa649 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,3 +1,4 @@ +import 'package:checkmein/utils/theme_data.dart'; import 'package:flutter/material.dart'; import 'utils/locator.dart'; import 'views/home.dart'; @@ -16,9 +17,11 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( - title: 'Exam Émargement', - theme: ThemeData(primarySwatch: Colors.blue), - home: const HomePage(), + title: 'Flutter Theme Demo', + theme: lightTheme, + darkTheme: darkTheme, + themeMode: ThemeMode.system, + home: HomePage(), ); } } diff --git a/lib/utils/theme_data.dart b/lib/utils/theme_data.dart new file mode 100644 index 0000000..aed172a --- /dev/null +++ b/lib/utils/theme_data.dart @@ -0,0 +1,21 @@ +import 'package:flutter/material.dart'; + +final ThemeData lightTheme = ThemeData( + brightness: Brightness.light, + primarySwatch: Colors.blue, + scaffoldBackgroundColor: Colors.white, + appBarTheme: AppBarTheme( + color: Colors.blue, + foregroundColor: Colors.white, + ), +); + +final ThemeData darkTheme = ThemeData( + brightness: Brightness.dark, + primarySwatch: Colors.blue, + scaffoldBackgroundColor: Colors.black, + appBarTheme: AppBarTheme( + color: Colors.grey[900], + foregroundColor: Colors.white, + ), +); -- GitLab