diff --git a/CHANGELOG.md b/CHANGELOG.md index 6834a7f18..766d3e778 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.3 + +- Fix issue with current song not updated on search route + ## 1.0.2 - Selection is now everywhere - all songs, all albums, queue, search route - every content entry is now selectable diff --git a/lib/routes/home_route/search_route.dart b/lib/routes/home_route/search_route.dart index e824a282b..41cb74ea3 100644 --- a/lib/routes/home_route/search_route.dart +++ b/lib/routes/home_route/search_route.dart @@ -570,53 +570,61 @@ class _DelegateBuilder extends StatelessWidget { final contentListContentType = single ? contentTypeEntries.single.key : contentType; return NFBackButtonListener( onBackButtonPressed: () => _handlePop(delegate), - child: PageTransitionSwitcher( - duration: const Duration(milliseconds: 300), - reverse: !single && contentType == null, - transitionBuilder: (child, animation, secondaryAnimation) => SharedAxisTransition( - transitionType: SharedAxisTransitionType.vertical, - animation: animation, - secondaryAnimation: secondaryAnimation, - fillColor: Colors.transparent, - child: child, - ), - child: Container( - key: ValueKey(contentType), - child: showSingleCategoryContentList - ? () { - final list = single - ? contentTypeEntries.single.value - : contentPick>( - contentType: contentType, - song: delegate.results.songs, - album: delegate.results.albums, - ); - return ContentListView( - contentType: contentListContentType, - controller: delegate.singleListScrollController, - selectionController: delegate.selectionController, - selectedTest: (index) =>delegate.selectionController.data - .firstWhereOrNull((el) => el.data == list[index]) != null, - onItemTap: delegate.getContentTileTapHandler(contentListContentType), - list: list, - ); - } () - : - // AppScrollbar( // TODO: enable this when i have more content on search screen - // controller: delegate.scrollController, - // child: - ListView( - controller: delegate.scrollController, - children: [ - for (final entry in contentTypeEntries) - if (entry.value.isNotEmpty) - _ContentSection( - contentType: entry.key, - items: results.map[entry.key], - onTap: () => delegate.contentType = entry.key, - ), - ], - ), + child: + StreamBuilder( + stream: ContentControl.state.onSongChange, + builder: (context, snapshot) => + StreamBuilder(stream: ContentControl.state.onContentChange, + builder: (context, snapshot) => + PageTransitionSwitcher( + duration: const Duration(milliseconds: 300), + reverse: !single && contentType == null, + transitionBuilder: (child, animation, secondaryAnimation) => SharedAxisTransition( + transitionType: SharedAxisTransitionType.vertical, + animation: animation, + secondaryAnimation: secondaryAnimation, + fillColor: Colors.transparent, + child: child, + ), + child: Container( + key: ValueKey(contentType), + child: showSingleCategoryContentList + ? () { + final list = single + ? contentTypeEntries.single.value + : contentPick>( + contentType: contentType, + song: delegate.results.songs, + album: delegate.results.albums, + ); + return ContentListView( + contentType: contentListContentType, + controller: delegate.singleListScrollController, + selectionController: delegate.selectionController, + selectedTest: (index) =>delegate.selectionController.data + .firstWhereOrNull((el) => el.data == list[index]) != null, + onItemTap: delegate.getContentTileTapHandler(contentListContentType), + list: list, + ); + } () + : + // AppScrollbar( // TODO: enable this when i have more content on search screen + // controller: delegate.scrollController, + // child: + ListView( + controller: delegate.scrollController, + children: [ + for (final entry in contentTypeEntries) + if (entry.value.isNotEmpty) + _ContentSection( + contentType: entry.key, + items: results.map[entry.key], + onTap: () => delegate.contentType = entry.key, + ), + ], + ), + ), + ), ), ), ); diff --git a/lib/routes/home_route/tabs_route.dart b/lib/routes/home_route/tabs_route.dart index 1cea002fc..9006794c6 100644 --- a/lib/routes/home_route/tabs_route.dart +++ b/lib/routes/home_route/tabs_route.dart @@ -46,8 +46,6 @@ class TabsRoute extends StatefulWidget { class TabsRouteState extends State with TickerProviderStateMixin, SelectionHandler { ContentSelectionController selectionController; TabController tabController; - StreamSubscription _songChangeSubscription; - StreamSubscription _contentChangeSubscription; @override void initState() { @@ -62,23 +60,12 @@ class TabsRouteState extends State with TickerProviderStateMixin, Sel vsync: this, length: 2, ); - _songChangeSubscription = ContentControl.state.onSongChange.listen((event) { - setState(() {/* update current track indicator */}); - }); - _contentChangeSubscription = ContentControl.state.onContentChange.listen((event) { - setState(() {/* update to display possible changes in the list */}); - }); - tabController.addListener(() { - setState(() {/* update to change currently used selection controller */}); - }); } @override void dispose() { selectionController.dispose(); tabController.dispose(); - _contentChangeSubscription.cancel(); - _songChangeSubscription.cancel(); super.dispose(); } @@ -162,6 +149,12 @@ class TabsRouteState extends State with TickerProviderStateMixin, Sel ), child: Stack( children: [ + StreamBuilder( + stream: ContentControl.state.onSongChange, + builder: (context, snapshot) => + StreamBuilder( + stream: ContentControl.state.onContentChange, + builder: (context, snapshot) => ScrollConfiguration( behavior: const GlowlessScrollBehavior(), child: Padding( @@ -179,7 +172,7 @@ class TabsRouteState extends State with TickerProviderStateMixin, Sel ], ), ), - ), + ))), if (ContentControl.state.albums.isNotEmpty) IgnorePointer( ignoring: selectionController.inSelection, diff --git a/pubspec.yaml b/pubspec.yaml index 12fdd390b..de94eca82 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ homepage: https://github.com/nt4f04uNd/sweyer repository: https://github.com/nt4f04uNd/sweyer issue_tracker: https://github.com/nt4f04uNd/sweyer/issues publish_to: none -version: 1.0.2+3 +version: 1.0.3+4 environment: sdk: ">=2.6.0<3.0.0"