From 459047e2c4542efa179f4929daa06a5395f45502 Mon Sep 17 00:00:00 2001 From: Dayron Date: Sat, 1 Nov 2025 18:05:04 +0100 Subject: [PATCH] feat: Update theme colors for improved visibility in light and dark modes across multiple components --- lib/components/home/home_content.dart | 15 +++++++++++++-- .../settings/settings_theme_content.dart | 1 - lib/main.dart | 12 ++++++++++++ lib/pages/home.dart | 15 ++++++++++----- 4 files changed, 35 insertions(+), 8 deletions(-) diff --git a/lib/components/home/home_content.dart b/lib/components/home/home_content.dart index 2b1969b..d0ac910 100644 --- a/lib/components/home/home_content.dart +++ b/lib/components/home/home_content.dart @@ -148,12 +148,23 @@ class _HomeContentState extends State with AutomaticKeepAliveClient children: [ Text( 'Bonjour ${user.prenom} !', - style: const TextStyle(fontSize: 28, fontWeight: FontWeight.bold), + style: TextStyle( + fontSize: 28, + fontWeight: FontWeight.bold, + color: Theme.of(context).brightness == Brightness.dark + ? Colors.white + : Colors.black, + ), ), const SizedBox(height: 8), Text( 'Vos voyages', - style: TextStyle(fontSize: 16, color: Colors.grey[600]), + style: TextStyle( + fontSize: 16, + color: Theme.of(context).brightness == Brightness.dark + ? Colors.white70 + : Colors.grey[600], + ), ), const SizedBox(height: 20), diff --git a/lib/components/settings/settings_theme_content.dart b/lib/components/settings/settings_theme_content.dart index 96043a3..a0537fa 100644 --- a/lib/components/settings/settings_theme_content.dart +++ b/lib/components/settings/settings_theme_content.dart @@ -12,7 +12,6 @@ class SettingsThemeContent extends StatelessWidget { return Scaffold( appBar: AppBar( title: const Text('Thème'), - backgroundColor: Theme.of(context).colorScheme.inversePrimary, ), body: BlocBuilder( builder: (context, state) { diff --git a/lib/main.dart b/lib/main.dart index 50073ac..d57900b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -171,6 +171,12 @@ class MyApp extends StatelessWidget { brightness: Brightness.light, ), useMaterial3: true, + appBarTheme: const AppBarTheme( + backgroundColor: Colors.white, + foregroundColor: Colors.black, + elevation: 0, + surfaceTintColor: Colors.transparent, + ), ), // Dark theme configuration darkTheme: ThemeData( @@ -179,6 +185,12 @@ class MyApp extends StatelessWidget { brightness: Brightness.dark, ), useMaterial3: true, + appBarTheme: const AppBarTheme( + backgroundColor: Colors.black, + foregroundColor: Colors.white, + elevation: 0, + surfaceTintColor: Colors.transparent, + ), ), // Default page when app starts home: const LoginPage(), diff --git a/lib/pages/home.dart b/lib/pages/home.dart index 3535370..47dab09 100644 --- a/lib/pages/home.dart +++ b/lib/pages/home.dart @@ -134,8 +134,6 @@ class _HomePageState extends State { return Scaffold( appBar: AppBar( title: Text(titles[_currentIndex]), - backgroundColor: Theme.of(context).colorScheme.inversePrimary, - foregroundColor: Colors.white, ), drawer: Drawer( child: ListView( @@ -143,11 +141,18 @@ class _HomePageState extends State { children: [ DrawerHeader( decoration: BoxDecoration( - color: Theme.of(context).colorScheme.inversePrimary, + color: Theme.of(context).brightness == Brightness.dark + ? Colors.black + : Colors.white, ), - child: const Text( + child: Text( "Travel Mate", - style: TextStyle(color: Colors.white, fontSize: 24), + style: TextStyle( + color: Theme.of(context).brightness == Brightness.dark + ? Colors.white + : Colors.black, + fontSize: 24, + ), ), ), _buildDrawerItem(icon: Icons.home, title: "Mes voyages", index: 0),