Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow the system theme by default #140

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mrkrash
Copy link
Contributor

@mrkrash mrkrash commented Jan 28, 2025

Add settings and behaviors to choose between dark light or follow system theme

Close #87

@mrkrash mrkrash force-pushed the feat/follow-system-theme branch 2 times, most recently from f92e177 to c11d2f0 Compare January 28, 2025 21:00
@mrkrash mrkrash force-pushed the feat/follow-system-theme branch from c11d2f0 to 78669d0 Compare January 28, 2025 21:26
Copy link
Owner

@amugofjava amugofjava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @mrkrash,

Overall, great stuff. It generally works, but because you are still effectively returning a boolean from the themeMode getter, the settings page breaks when you restart Anytime.

It would also be more consistent with other parts of the UI it the theme was not a drop down box, but a modal selector in the same style as the 'Auto update episodes' and 'Search provider' options.

This change also needs translations. I can help with this, but generally for short phrases I use a combination of Google Translate & Bing Translator. This change will need translations for Italian & German.


return theme == 'dark';
String get themeMode {
var value = _sharedPreferences.getString('theme') ?? ThemeMode.system.name;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You fetch the stored preference and default to system if not set, which is good.

if (value == ThemeMode.system.name) {
var brightness = SchedulerBinding.instance.platformDispatcher
.platformBrightness;
return brightness == Brightness.dark ? ThemeMode.dark.name : ThemeMode.light.name;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But here, you effectively overwrite system with dark or light depending upon the current system theme. Whilst you have changed the return type from bool to String, you are effectively still returning a boolean of either light or dark. This works fine for setting the overall theme, but breaks the setting page.

onSelected: (value) {
settingsBloc.themeMode(value!);
},
dropdownMenuEntries: [
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you set the theme to Auto and restart Anytime, when you go back into settings rather than Auto being selected either Light or Dark will be selected depending upon the current theme.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, as behaviour is abnormal. I fix it.

@mrkrash mrkrash force-pushed the feat/follow-system-theme branch from 80ba5aa to e3b7b8d Compare February 14, 2025 00:15
@mrkrash mrkrash force-pushed the feat/follow-system-theme branch from 38ef476 to 23eeeb9 Compare February 14, 2025 00:20
@mrkrash mrkrash requested a review from amugofjava February 14, 2025 00:21
@mrkrash
Copy link
Contributor Author

mrkrash commented Feb 14, 2025

I think that now work correctly. Probably need to update the labels and translate the German

@amugofjava
Copy link
Owner

Thanks @mrkrash - I will try and review this over the weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Follow the system theme by default
2 participants