From 27ab9633f6ce2f975c023438d9cc30c6981d8ba6 Mon Sep 17 00:00:00 2001 From: Frederik Feichtmeier Date: Wed, 30 Oct 2024 17:58:06 +0100 Subject: [PATCH] fix: radiosearch empty on initial search swap from podcasts, add back radio search -> StationPage routing (#989) --- lib/common/view/audio_tile.dart | 22 ++++++++--- lib/library/library_model.dart | 37 ++++--------------- lib/player/player_model.dart | 3 -- lib/player/view/player_title_and_artist.dart | 2 +- lib/search/search_model.dart | 4 +- .../view/sliver_radio_search_results.dart | 24 +++++++----- 6 files changed, 43 insertions(+), 49 deletions(-) diff --git a/lib/common/view/audio_tile.dart b/lib/common/view/audio_tile.dart index 5368e9650..e140a21b3 100644 --- a/lib/common/view/audio_tile.dart +++ b/lib/common/view/audio_tile.dart @@ -30,6 +30,7 @@ class AudioTile extends StatefulWidget with WatchItStatefulWidgetMixin { required this.audioPageType, required this.showLeading, this.selectedColor, + this.onTitleTap, }); final String pageId; @@ -39,6 +40,7 @@ class AudioTile extends StatefulWidget with WatchItStatefulWidgetMixin { final bool isPlayerPlaying; final void Function()? onTap; + final void Function()? onTitleTap; final void Function(String text)? onSubTitleTap; final void Function(Audio audio)? insertIntoQueue; final bool showLeading; @@ -78,6 +80,9 @@ class _AudioTileState extends State { ), }; + const titleOverflow = TextOverflow.ellipsis; + const titleMaxLines = 1; + return MouseRegion( key: ObjectKey(widget.audio), onEnter: (e) { @@ -111,11 +116,18 @@ class _AudioTileState extends State { }, title: Padding( padding: const EdgeInsets.only(right: kYaruPagePadding), - child: Text( - widget.audio.title ?? l10n.unknown, - overflow: TextOverflow.ellipsis, - maxLines: 1, - ), + child: widget.onTitleTap == null + ? Text( + widget.audio.title ?? l10n.unknown, + overflow: titleOverflow, + maxLines: titleMaxLines, + ) + : TapAbleText( + onTap: widget.onTitleTap, + text: widget.audio.title ?? l10n.unknown, + overflow: titleOverflow, + maxLines: titleMaxLines, + ), ), subtitle: TapAbleText( text: subTitle, diff --git a/lib/library/library_model.dart b/lib/library/library_model.dart index ca136c2f7..77181e0eb 100644 --- a/lib/library/library_model.dart +++ b/lib/library/library_model.dart @@ -16,10 +16,8 @@ class LibraryModel extends SafeChangeNotifier implements NavigatorObserver { Future init() async { await _service.init(); - _propertiesChangedSub ??= _service.propertiesChanged.listen((_) => notifyListeners()); - notifyListeners(); return true; } @@ -41,6 +39,8 @@ class LibraryModel extends SafeChangeNotifier implements NavigatorObserver { } } + bool isPageInLibrary(String? pageId) => _service.isPageInLibrary(pageId); + // // Liked Audios // @@ -48,14 +48,10 @@ class LibraryModel extends SafeChangeNotifier implements NavigatorObserver { void addLikedAudio(Audio audio, [bool notify = true]) => _service.addLikedAudio(audio, notify); - void addLikedAudios(List