Skip to content

Commit

Permalink
Merge branch 'main' into 213-bug-info-label-text-not-readable-if-its-…
Browse files Browse the repository at this point in the history
…launched-in-dark-mode
  • Loading branch information
bostrot committed Aug 22, 2023
2 parents 51a2dce + 95789b6 commit 30a4bc1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
1 change: 0 additions & 1 deletion lib/components/navbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ class _NavbarState extends State<Navbar> {
checked: FluentTheme.of(context).brightness.isDark,
onChanged: (v) {
// Notify settings page to save unsaved changes

customTheme = true;
if (v) {
appTheme.mode = ThemeMode.dark;
Expand Down
6 changes: 3 additions & 3 deletions lib/dialogs/info_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ class ClickableDependency extends StatelessWidget {
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Button(
HyperlinkButton(
onPressed: () =>
launchUrl(Uri.parse("https://pub.dev/packages/$name")),
child: Text(name)),
Button(
HyperlinkButton(
onPressed: () => launchUrl(
Uri.parse("https://pub.dev/packages/$name/license")),
child: const Text("(LICENSE)")),
Expand All @@ -178,7 +178,7 @@ class ClickableUrl extends StatelessWidget {
Widget build(BuildContext context) {
return MouseRegion(
cursor: SystemMouseCursors.click,
child: Button(
child: HyperlinkButton(
onPressed: () async {
plausible.event(name: clickEvent);
launchUrl(Uri.parse(url));
Expand Down
2 changes: 1 addition & 1 deletion lib/dialogs/install_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class InstallDialog extends StatelessWidget {
color: const Color.fromRGBO(0, 0, 0, 0.2),
child: Padding(
padding: const EdgeInsets.only(left: 4.0, right: 4.0),
child: Button(
child: HyperlinkButton(
onPressed: () {
plausible.event(name: "wsl_install");
WSLApi().installWSL();
Expand Down
25 changes: 14 additions & 11 deletions lib/nav/init.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ initRoot(statusMsg) async {
// First start with this version
String? version = prefs.getString('version');

// Get system dark mode
var brightness =
WidgetsBinding.instance.platformDispatcher.platformBrightness;

if (brightness == Brightness.dark) {
AppTheme().mode = ThemeMode.dark;
} else if (brightness == Brightness.light) {
AppTheme().mode = ThemeMode.light;
}

if (version == null) {
// First start
prefs.setString('version', currentVersion);
Expand Down Expand Up @@ -86,6 +96,10 @@ initRoot(statusMsg) async {
}
});

// if (kDebugMode) {
// prefs.remove('LastMotd');
// }

// Check motd Show once a day
if (prefs.getString('LastMotd') !=
DateTime.now().toString().substring(0, 10)) {
Expand All @@ -96,15 +110,4 @@ initRoot(statusMsg) async {
}
});
}

// if (kDebugMode) {
// prefs.remove('LastMotd');
// }

// Get system dark mode
if (ThemeMode.system == ThemeMode.dark) {
AppTheme().mode = ThemeMode.dark;
} else if (ThemeMode.system == ThemeMode.light) {
AppTheme().mode = ThemeMode.light;
}
}

0 comments on commit 30a4bc1

Please sign in to comment.