Skip to content

Commit

Permalink
fix: dark theme mode
Browse files Browse the repository at this point in the history
  • Loading branch information
prateekmedia committed Aug 25, 2022
1 parent 80ac8e7 commit 477444c
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
4 changes: 3 additions & 1 deletion lib/src/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -35,7 +37,7 @@ class MyApp extends ConsumerWidget {
},
theme: AppTheme.light,
darkTheme: AppTheme.dark,
themeMode: ref.watch(themeModeProvider),
themeMode: themeMode,
home: const HomePage(),
);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/features/download/data/download_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class DownloadingStatusNotifier extends ChangeNotifier {
try {
Directory(location).createSync();
} catch (e) {
debugPrint(e.toString());
debugPrint("$e");
return;
}
}
Expand Down
15 changes: 7 additions & 8 deletions lib/src/features/home/data/appimage_tools_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,28 +97,27 @@ class AppimageToolsRepository {
.trim();

// Update desktop file
debugPrint((await Process.run(
await Process.run(
"sed",
[
"s:Exec=$execPath:Exec=$newPath:g",
desktopfilename,
"-i",
],
workingDirectory: _localPathService.applicationsDir,
))
.stderr);
debugPrint((await Process.run(
);

await Process.run(
"sed",
[
"s:Icon=$iconName:Icon=aip_${iconName}_$checksum:",
"-i",
desktopfilename,
],
workingDirectory: _localPathService.applicationsDir,
))
.stderr);
} catch (_) {
debugPrint("Desktop fileSystemEnFileSystemEntity not found!");
);
} catch (e) {
debugPrint("$e");
}

// Copy Icons
Expand Down
2 changes: 1 addition & 1 deletion lib/src/features/home/presentation/home/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class _HomePageState extends ConsumerState<HomePage> {
"https://gist.githubusercontent.com/prateekmedia/44c1ea7f7a627d284b9e50d47aa7200f/raw/gistfile1.txt"))
.data);
} catch (e) {
debugPrint(e.toString());
debugPrint("$e");
setState(() => _isConnected = false);
return;
}
Expand Down
5 changes: 2 additions & 3 deletions lib/src/features/home/presentation/home/prefs_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions lib/src/features/theme/application/theme_mode.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ final themeModeProvider =
class ThemeModeNotifier extends StateNotifier<ThemeMode> {
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);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/features/theme/domain/app_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

0 comments on commit 477444c

Please sign in to comment.