From c0b1f5c1d2d78ea3a7280e834943cff71029a990 Mon Sep 17 00:00:00 2001 From: Feichtmeier Date: Fri, 10 May 2024 00:47:34 +0200 Subject: [PATCH] Fix podcast/playlist search --- lib/src/playlists/view/liked_audio_page.dart | 1 - lib/src/playlists/view/playlist_page.dart | 1 + lib/src/podcasts/podcast_model.dart | 6 +++--- lib/src/podcasts/view/podcast_page.dart | 2 ++ lib/src/podcasts/view/podcasts_page.dart | 5 +++-- pubspec.yaml | 2 +- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/src/playlists/view/liked_audio_page.dart b/lib/src/playlists/view/liked_audio_page.dart index 63e66d56a..c3680ce3e 100644 --- a/lib/src/playlists/view/liked_audio_page.dart +++ b/lib/src/playlists/view/liked_audio_page.dart @@ -66,7 +66,6 @@ class LikedAudioPage extends StatelessWidget with WatchItMixin { audioPageType: AudioPageType.likedAudio, pageId: kLikedAudiosPageId, pageTitle: context.l10n.likedSongs, - // pageSubTitle: context.l10n.likedSongsSubtitle, pageLabel: context.l10n.likedSongsSubtitle, image: FallBackHeaderImage( child: Icon( diff --git a/lib/src/playlists/view/playlist_page.dart b/lib/src/playlists/view/playlist_page.dart index a594bf0c0..2d75f2081 100644 --- a/lib/src/playlists/view/playlist_page.dart +++ b/lib/src/playlists/view/playlist_page.dart @@ -354,6 +354,7 @@ class _PlaylistPageBody extends StatelessWidget with WatchItMixin { audios: audios, pageId: pageId, audioPageType: AudioPageType.playlist, + onSubTitleTab: onArtistTap, ), ], ), diff --git a/lib/src/podcasts/podcast_model.dart b/lib/src/podcasts/podcast_model.dart index 8e8362a83..a5e4ec0cb 100644 --- a/lib/src/podcasts/podcast_model.dart +++ b/lib/src/podcasts/podcast_model.dart @@ -25,8 +25,8 @@ class PodcastModel extends SafeChangeNotifier { SearchResult? get searchResult => _podcastService.searchResult; - bool _searchActive = false; - bool get searchActive => _searchActive; + bool? _searchActive; + bool? get searchActive => _searchActive; void setSearchActive(bool value) { if (value == _searchActive) return; _searchActive = value; @@ -107,7 +107,7 @@ class PodcastModel extends SafeChangeNotifier { }) async { await _podcastService.init(forceInit: forceInit); - _searchActive = _libraryService.podcasts.isEmpty; + _searchActive ??= _libraryService.podcasts.isEmpty; _country ??= Country.values.firstWhereOrNull( (c) => c.code == (_libraryService.lastCountryCode ?? countryCode), diff --git a/lib/src/podcasts/view/podcast_page.dart b/lib/src/podcasts/view/podcast_page.dart index 4426d7ee4..518148576 100644 --- a/lib/src/podcasts/view/podcast_page.dart +++ b/lib/src/podcasts/view/podcast_page.dart @@ -38,6 +38,8 @@ class PodcastPage extends StatelessWidget with WatchItMixin { void onTap(text) { final podcastModel = getIt(); Navigator.of(context).maybePop(); + getIt().setIndex(2); + podcastModel.setSearchActive(true); podcastModel.setSearchQuery(text); podcastModel.search(searchQuery: text); } diff --git a/lib/src/podcasts/view/podcasts_page.dart b/lib/src/podcasts/view/podcasts_page.dart index c3c74bde0..d69ba5d03 100644 --- a/lib/src/podcasts/view/podcasts_page.dart +++ b/lib/src/podcasts/view/podcasts_page.dart @@ -43,7 +43,8 @@ class _PodcastsPageState extends State { final model = getIt(); - final searchActive = watchPropertyValue((PodcastModel m) => m.searchActive); + final searchActive = + watchPropertyValue((PodcastModel m) => m.searchActive ?? false); final setSearchActive = model.setSearchActive; final search = model.search; @@ -81,7 +82,7 @@ class _PodcastsPageState extends State { padding: appBarActionSpacing, child: SearchButton( active: searchActive, - onPressed: () => setSearchActive(!searchActive), + onPressed: () => setSearchActive(!(searchActive)), ), ), ), diff --git a/pubspec.yaml b/pubspec.yaml index cd5158d0e..87ea88639 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: musicpod description: Ubuntu music, radio and podcast player. -version: 1.3.8 +version: 1.3.9 publish_to: "none"