diff --git a/lib/src/app.dart b/lib/src/app.dart index d1043ac..b02bc9b 100644 --- a/lib/src/app.dart +++ b/lib/src/app.dart @@ -22,6 +22,26 @@ class App extends StatefulWidget { } class _AppState extends State with PreferencesMixin { + // Define the primary dark grey color. + static const int _darkGreyPrimaryValue = 0xFF424242; + + // Create a map of shades for the dark grey color. + static const MaterialColor darkGrey = MaterialColor( + _darkGreyPrimaryValue, + { + 50: Color(0xFFE0E0E0), + 100: Color(0xFFBDBDBD), + 200: Color(0xFF9E9E9E), + 300: Color(0xFF757575), + 400: Color(0xFF616161), + 500: Color(_darkGreyPrimaryValue), + 600: Color(0xFF3D3D3D), + 700: Color(0xFF333333), + 800: Color(0xFF2B2B2B), + 900: Color(0xFF1C1C1C), + }, + ); + @override Widget build(BuildContext context) { return FutureBuilder( @@ -39,8 +59,21 @@ class _AppState extends State with PreferencesMixin { } return Consumer( builder: (context, appSettings, _) => MaterialApp( - theme: ThemeData(primarySwatch: Colors.pink), - darkTheme: ThemeData.dark(), + theme: ThemeData( + useMaterial3: true, + colorScheme: ColorScheme.fromSwatch( + primarySwatch: Colors.pink, + backgroundColor: Colors.white, + ) + ), + darkTheme: ThemeData( + useMaterial3: true, + colorScheme: ColorScheme.fromSwatch( + primarySwatch: darkGrey, + backgroundColor: darkGrey.shade700, + brightness: Brightness.dark, + ), + ), themeMode: appSettings.themeMode, home: AppVersion.packageInfo == null ? const DebgetNotFoundPage() diff --git a/lib/src/pages/main_page.dart b/lib/src/pages/main_page.dart index 823b735..bc15d9c 100644 --- a/lib/src/pages/main_page.dart +++ b/lib/src/pages/main_page.dart @@ -26,6 +26,8 @@ class _MainPageState extends State { return Scaffold( appBar: AppBar( title: Text(context.t('Main menu')), + backgroundColor: Theme.of(context).colorScheme.primary, + foregroundColor: Theme.of(context).colorScheme.onPrimary, ), drawer: const LeftMenu(), body: const Column( diff --git a/lib/src/pages/manager.dart b/lib/src/pages/manager.dart index a2e14f2..8d8b626 100644 --- a/lib/src/pages/manager.dart +++ b/lib/src/pages/manager.dart @@ -174,9 +174,7 @@ class _ManagerState extends State with PreferencesMixin { Widget _buildVmList() { List widgetList = []; - final Color buttonColor = Theme.of(context).brightness == Brightness.dark - ? Colors.white70 - : Theme.of(context).colorScheme.primary; + final Color buttonColor = Theme.of(context).colorScheme.primary; widgetList.addAll( [ Padding( @@ -186,30 +184,30 @@ class _ManagerState extends State with PreferencesMixin { children: [ Text( "${context.t('Directory where the machines are stored')}:", + style: TextStyle( + color: Theme.of(context).colorScheme.onSurface, + ), ), const SizedBox( width: 8, ), - Text.rich( - TextSpan( - recognizer: TapGestureRecognizer() - ..onTap = () async { - String? result = - await FilePicker.platform.getDirectoryPath(); - if (result != null) { - setState(() { - Directory.current = result; - }); - - savePreference( - prefWorkingDirectory, Directory.current.path); - _getVms(context); - } - }, - text: Directory.current.path, - style: - TextStyle(color: Theme.of(context).colorScheme.primary), + ElevatedButton( + style: ElevatedButton.styleFrom( + foregroundColor: Theme.of(context).colorScheme.onSurface, + backgroundColor: Theme.of(context).colorScheme.surface, ), + onPressed: () async { + var folder = await FilePicker.platform + .getDirectoryPath(dialogTitle: "Pick a folder"); + if (folder != null) { + setState(() { + Directory.current = folder; + }); + savePreference( + prefWorkingDirectory, Directory.current.path); + } + }, + child: Text(Directory.current.path), ), ], ), diff --git a/lib/src/widgets/downloader/cancel_dismiss_button.dart b/lib/src/widgets/downloader/cancel_dismiss_button.dart index 994ebb7..ffcf574 100644 --- a/lib/src/widgets/downloader/cancel_dismiss_button.dart +++ b/lib/src/widgets/downloader/cancel_dismiss_button.dart @@ -21,9 +21,7 @@ class CancelDismissButton extends StatelessWidget { ElevatedButton( style: ElevatedButton.styleFrom( backgroundColor: Theme.of(context).colorScheme.surface, - foregroundColor: Theme.of(context).brightness == Brightness.dark - ? Colors.white70 - : Theme.of(context).colorScheme.primary, + foregroundColor: Theme.of(context).colorScheme.onSurface, ), onPressed: !downloadFinished ? onCancel diff --git a/lib/src/widgets/home_page/downloader_menu.dart b/lib/src/widgets/home_page/downloader_menu.dart index f884fa7..6e2fa06 100644 --- a/lib/src/widgets/home_page/downloader_menu.dart +++ b/lib/src/widgets/home_page/downloader_menu.dart @@ -31,9 +31,7 @@ class _DownloaderMenuState extends State with PreferencesMixin { Widget build(BuildContext context) { return Expanded( child: Container( - color: Theme.of(context).brightness == Brightness.dark - ? Theme.of(context).colorScheme.surface - : Theme.of(context).colorScheme.primary, + color: Theme.of(context).colorScheme.primaryContainer, child: Column( children: [ Padding( @@ -44,9 +42,7 @@ class _DownloaderMenuState extends State with PreferencesMixin { Text( "${context.t('Directory where the machines are stored')}:", style: TextStyle( - color: Theme.of(context).brightness == Brightness.dark - ? Theme.of(context).colorScheme.onSurface - : Theme.of(context).colorScheme.onPrimary, + color: Theme.of(context).colorScheme.onPrimaryContainer, ), ), const SizedBox( @@ -54,10 +50,8 @@ class _DownloaderMenuState extends State with PreferencesMixin { ), ElevatedButton( style: ElevatedButton.styleFrom( - foregroundColor: Theme.of(context).brightness == Brightness.dark - ? Colors.white70 - : Theme.of(context).colorScheme.primary, - backgroundColor: Theme.of(context).canvasColor, + foregroundColor: Theme.of(context).colorScheme.onSurface, + backgroundColor: Theme.of(context).colorScheme.surface, ), onPressed: () async { var folder = await FilePicker.platform diff --git a/lib/src/widgets/home_page/downloader_page_button.dart b/lib/src/widgets/home_page/downloader_page_button.dart index 20b1515..bcc6cd5 100644 --- a/lib/src/widgets/home_page/downloader_page_button.dart +++ b/lib/src/widgets/home_page/downloader_page_button.dart @@ -35,10 +35,8 @@ class DownloaderPageButton extends StatelessWidget { ), ElevatedButton( style: ElevatedButton.styleFrom( - foregroundColor: Theme.of(context).brightness == Brightness.dark - ? Colors.white70 - : Theme.of(context).colorScheme.primary, - backgroundColor: Theme.of(context).canvasColor, + foregroundColor: Theme.of(context).colorScheme.onSurface, + backgroundColor: Theme.of(context).colorScheme.surface, ), onPressed: onPressed, child: Padding( diff --git a/lib/src/widgets/home_page/home_page_button.dart b/lib/src/widgets/home_page/home_page_button.dart index 5345145..76e6d1a 100644 --- a/lib/src/widgets/home_page/home_page_button.dart +++ b/lib/src/widgets/home_page/home_page_button.dart @@ -32,10 +32,8 @@ class HomePageButton extends StatelessWidget { ), ElevatedButton( style: ElevatedButton.styleFrom( - backgroundColor: Theme.of(context).canvasColor, - foregroundColor: Theme.of(context).brightness == Brightness.dark - ? Colors.white70 - : Theme.of(context).colorScheme.primary, + backgroundColor: Theme.of(context).colorScheme.surface, + foregroundColor: Theme.of(context).colorScheme.onSurface, ), onPressed: onPressed, child: Padding( diff --git a/lib/src/widgets/home_page/main_menu.dart b/lib/src/widgets/home_page/main_menu.dart index 9784421..6553b7b 100644 --- a/lib/src/widgets/home_page/main_menu.dart +++ b/lib/src/widgets/home_page/main_menu.dart @@ -12,9 +12,7 @@ class MainMenu extends StatelessWidget { Widget build(BuildContext context) { return Expanded( child: Container( - color: Theme.of(context).brightness == Brightness.dark - ? Theme.of(context).colorScheme.surface - : Theme.of(context).colorScheme.primary, + color: Theme.of(context).colorScheme.primaryContainer, child: Padding( padding: const EdgeInsets.all(8.0), child: Row( diff --git a/lib/src/widgets/left_menu.dart b/lib/src/widgets/left_menu.dart index b7a8596..a36c3d9 100644 --- a/lib/src/widgets/left_menu.dart +++ b/lib/src/widgets/left_menu.dart @@ -58,11 +58,15 @@ class _LeftMenuState extends State with PreferencesMixin { child: Container(), ), Switch( - value: Theme.of(context).brightness == Brightness.dark, + value: Theme.of(context).colorScheme.brightness == Brightness.dark, onChanged: (value) { appSettings.useDarkMode = value; savePreference(prefThemeMode, value); }, + activeColor: Colors.white, + activeTrackColor: Colors.black26, + inactiveThumbColor: Theme.of(context).colorScheme.onPrimary, + inactiveTrackColor: Theme.of(context).colorScheme.primary, ), ], ),