-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add spotify homepage recommendations
- Loading branch information
Showing
18 changed files
with
2,456 additions
and
17 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:hooks_riverpod/hooks_riverpod.dart'; | ||
import 'package:spotube/collections/spotube_icons.dart'; | ||
import 'package:spotube/components/shared/horizontal_playbutton_card_view/horizontal_playbutton_card_view.dart'; | ||
import 'package:spotube/provider/spotify/views/home.dart'; | ||
import 'package:spotube/utils/service_utils.dart'; | ||
|
||
class HomePageFeedSection extends HookConsumerWidget { | ||
const HomePageFeedSection({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context, ref) { | ||
final homeFeed = ref.watch(homeViewProvider); | ||
final nonShortSections = homeFeed.asData?.value?.sections | ||
.where((s) => s.typename == "HomeGenericSectionData") | ||
.toList() ?? | ||
[]; | ||
|
||
return SliverList.builder( | ||
itemCount: nonShortSections.length, | ||
itemBuilder: (context, index) { | ||
final section = nonShortSections[index]; | ||
if (section.items.isEmpty) return const SizedBox.shrink(); | ||
|
||
return HorizontalPlaybuttonCardView( | ||
items: [ | ||
for (final item in section.items) | ||
if (item.album != null) | ||
item.album!.asAlbum | ||
else if (item.artist != null) | ||
item.artist!.asArtist | ||
else if (item.playlist != null) | ||
item.playlist!.asPlaylist | ||
], | ||
title: Text(section.title ?? "No Titel"), | ||
hasNextPage: false, | ||
isLoadingNextPage: false, | ||
onFetchMore: () {}, | ||
titleTrailing: Directionality( | ||
textDirection: TextDirection.rtl, | ||
child: TextButton.icon( | ||
label: const Text("Browse More"), | ||
icon: const Icon(SpotubeIcons.angleRight), | ||
onPressed: () => | ||
ServiceUtils.push(context, "/feeds/${section.uri}"), | ||
), | ||
), | ||
); | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.