diff --git a/lib/src/app.dart b/lib/src/app.dart index 1074e8e..d561340 100644 --- a/lib/src/app.dart +++ b/lib/src/app.dart @@ -13,7 +13,9 @@ class MyApp extends ConsumerWidget { @override Widget build(context, ref) { + final themeMode = ref.watch(themeModeProvider); final virtualWindowFrameBuilder = VirtualWindowFrameInit(); + return MaterialApp( debugShowCheckedModeBanner: false, supportedLocales: AppLocalizations.supportedLocales, @@ -35,7 +37,7 @@ class MyApp extends ConsumerWidget { }, theme: AppTheme.light, darkTheme: AppTheme.dark, - themeMode: ref.watch(themeModeProvider), + themeMode: themeMode, home: const HomePage(), ); } diff --git a/lib/src/features/download/data/download_provider.dart b/lib/src/features/download/data/download_provider.dart index 98a8546..0f4de84 100644 --- a/lib/src/features/download/data/download_provider.dart +++ b/lib/src/features/download/data/download_provider.dart @@ -62,7 +62,7 @@ class DownloadingStatusNotifier extends ChangeNotifier { try { Directory(location).createSync(); } catch (e) { - debugPrint(e.toString()); + debugPrint("$e"); return; } } diff --git a/lib/src/features/home/data/appimage_tools_repository.dart b/lib/src/features/home/data/appimage_tools_repository.dart index 1c27cf1..977ab4f 100644 --- a/lib/src/features/home/data/appimage_tools_repository.dart +++ b/lib/src/features/home/data/appimage_tools_repository.dart @@ -97,7 +97,7 @@ class AppimageToolsRepository { .trim(); // Update desktop file - debugPrint((await Process.run( + await Process.run( "sed", [ "s:Exec=$execPath:Exec=$newPath:g", @@ -105,9 +105,9 @@ class AppimageToolsRepository { "-i", ], workingDirectory: _localPathService.applicationsDir, - )) - .stderr); - debugPrint((await Process.run( + ); + + await Process.run( "sed", [ "s:Icon=$iconName:Icon=aip_${iconName}_$checksum:", @@ -115,10 +115,9 @@ class AppimageToolsRepository { desktopfilename, ], workingDirectory: _localPathService.applicationsDir, - )) - .stderr); - } catch (_) { - debugPrint("Desktop fileSystemEnFileSystemEntity not found!"); + ); + } catch (e) { + debugPrint("$e"); } // Copy Icons diff --git a/lib/src/features/home/presentation/home/home_page.dart b/lib/src/features/home/presentation/home/home_page.dart index a92d041..9bdb1cf 100644 --- a/lib/src/features/home/presentation/home/home_page.dart +++ b/lib/src/features/home/presentation/home/home_page.dart @@ -92,7 +92,7 @@ class _HomePageState extends ConsumerState { "https://gist.githubusercontent.com/prateekmedia/44c1ea7f7a627d284b9e50d47aa7200f/raw/gistfile1.txt")) .data); } catch (e) { - debugPrint(e.toString()); + debugPrint("$e"); setState(() => _isConnected = false); return; } diff --git a/lib/src/features/home/presentation/home/prefs_dialog.dart b/lib/src/features/home/presentation/home/prefs_dialog.dart index 1c5d914..8c3d616 100644 --- a/lib/src/features/home/presentation/home/prefs_dialog.dart +++ b/lib/src/features/home/presentation/home/prefs_dialog.dart @@ -110,9 +110,8 @@ class PrefsDialog extends HookConsumerWidget { AdwSwitchRow( title: AppLocalizations.of(context)!.forceDarkTheme, value: context.isDark, - onChanged: (value) => ref - .read(themeModeProvider.notifier) - .toggle(context.brightness), + onChanged: (value) => + ref.read(themeModeProvider.notifier).toggle(context.isDark), ), AdwSwitchRow( title: AppLocalizations.of(context)!.portableHome, diff --git a/lib/src/features/theme/application/theme_mode.dart b/lib/src/features/theme/application/theme_mode.dart index 9f94e2b..49a7fd0 100644 --- a/lib/src/features/theme/application/theme_mode.dart +++ b/lib/src/features/theme/application/theme_mode.dart @@ -13,8 +13,8 @@ final themeModeProvider = class ThemeModeNotifier extends StateNotifier { ThemeModeNotifier(state) : super(state); - toggle(Brightness brightness) { - state = brightness == Brightness.dark ? ThemeMode.light : ThemeMode.dark; + toggle(bool isDark) { + state = isDark ? ThemeMode.light : ThemeMode.dark; MyPrefs().prefs.setInt('forceDark', state.index); } diff --git a/lib/src/features/theme/domain/app_theme.dart b/lib/src/features/theme/domain/app_theme.dart index 79ded1d..cbd47aa 100644 --- a/lib/src/features/theme/domain/app_theme.dart +++ b/lib/src/features/theme/domain/app_theme.dart @@ -3,5 +3,5 @@ import 'package:flutter/material.dart'; class AppTheme { static ThemeData get light => AdwaitaThemeData.light(); - static ThemeData get dark => AdwaitaThemeData.light(); + static ThemeData get dark => AdwaitaThemeData.dark(); }