setPreferredLightTheme method
Set the preferred light theme for system theme following.
This theme will be used when the system is in light mode and followSystemTheme is enabled.
Useful when you have multiple light themes and want the user to choose which one to use for light mode.
Implementation
Future<void> setPreferredLightTheme(String themeId) async {
final theme = getThemeById(themeId);
if (theme == null || theme.type != NyThemeType.light) {
throw ArgumentError('Light theme with id "$themeId" not found.');
}
_preferredLightThemeId = themeId;
await _storage.savePreferredLightThemeId(themeId);
// If currently following system and in light mode, apply immediately
if (_followSystemTheme && !_isSystemDarkMode) {
_setThemeInternal(themeId, notify: true, persist: true);
}
}