Skip to content

Commit

Permalink
fix: Dynamic theme not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Losses committed Dec 3, 2024
1 parent 071d47b commit 00f0273
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/providers/status.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class PlaybackStatusProvider with ChangeNotifier {
void _updatePlaybackStatus(RustSignal<PlaybackStatus> signal) {
final newStatus = signal.message;
if (!_isPlaybackStatusEqual(_playbackStatus, newStatus)) {
final bool isNewTrack = _playbackStatus.id != newStatus.id;

_playbackStatus.state = newStatus.state;
_playbackStatus.progressSeconds = newStatus.progressSeconds;
_playbackStatus.progressPercentage = newStatus.progressPercentage;
Expand All @@ -59,9 +61,7 @@ class PlaybackStatusProvider with ChangeNotifier {
_playbackStatus.ready = newStatus.ready;
_playbackStatus.coverArtPath = newStatus.coverArtPath;

final bool isNewTrack = _playbackStatus.id != newStatus.id;

if (isNewTrack && newStatus.state != "Stopped") {
if (isNewTrack) {
ThemeColorManager().handleCoverArtColorChange(newStatus.id);
SettingsManager().setValue(lastQueueIndexKey, newStatus.index);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/screens/settings_theme/settings_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import '../../utils/settings_manager.dart';
import '../../utils/update_color_mode.dart';
import '../../utils/theme_color_manager.dart';
import '../../utils/settings_page_padding.dart';
import '../../widgets/tile/tile.dart';
import '../../widgets/settings/settings_box_toggle.dart';
import '../../widgets/settings/settings_block_title.dart';
import '../../widgets/settings/settings_box_combo_box.dart';
import '../../widgets/tile/tile.dart';
import '../../widgets/unavailable_page_on_band.dart';
import '../../widgets/navigation_bar/page_content_frame.dart';
import '../../widgets/unavailable_page_on_band.dart';

import 'constants/colors.dart';
import 'constants/window_sizes.dart';
Expand Down
8 changes: 8 additions & 0 deletions lib/utils/theme_color_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class ThemeColorManager {
// If dynamic colors are enabled and a song is currently playing, apply the cover color immediately
if (_currentCoverArtId != null) {
await handleCoverArtColorChange(_currentCoverArtId!);
} else {
appTheme.updateThemeColor(_userSelectedColor);
}
} else {
// If dynamic colors are disabled, decide which color to use based on user settings
Expand All @@ -52,6 +54,12 @@ class ThemeColorManager {
// If dynamic colors are not enabled, update the theme based on user selection
if (!_isDynamicColorEnabled) {
appTheme.updateThemeColor(color);
} else {
if (_currentCoverArtId != null) {
handleCoverArtColorChange(_currentCoverArtId!);
} else {
appTheme.updateThemeColor(color);
}
}
}

Expand Down

0 comments on commit 00f0273

Please sign in to comment.