mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
fix: Playlist refresh not working #915
This commit is contained in:
parent
b0beeca0cb
commit
5f1df5a87d
@ -28,16 +28,19 @@ class TrackView extends HookConsumerWidget {
|
||||
)
|
||||
: null,
|
||||
extendBodyBehindAppBar: true,
|
||||
body: CustomScrollView(
|
||||
slivers: [
|
||||
const TrackViewFlexHeader(),
|
||||
SliverAnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 500),
|
||||
child: props.tracks.isEmpty
|
||||
? const ShimmerTrackTileGroup()
|
||||
: const TrackViewBodySection(),
|
||||
),
|
||||
],
|
||||
body: RefreshIndicator(
|
||||
onRefresh: props.pagination.onRefresh,
|
||||
child: CustomScrollView(
|
||||
slivers: [
|
||||
const TrackViewFlexHeader(),
|
||||
SliverAnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 500),
|
||||
child: props.tracks.isEmpty
|
||||
? const ShimmerTrackTileGroup()
|
||||
: const TrackViewBodySection(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ class PaginationProps {
|
||||
final bool hasNextPage;
|
||||
final bool isLoading;
|
||||
final VoidCallback onFetchMore;
|
||||
final Future<void> Function() onRefresh;
|
||||
final Future<List<Track>> Function() onFetchAll;
|
||||
|
||||
const PaginationProps({
|
||||
@ -13,6 +14,7 @@ class PaginationProps {
|
||||
required this.isLoading,
|
||||
required this.onFetchMore,
|
||||
required this.onFetchAll,
|
||||
required this.onRefresh,
|
||||
});
|
||||
|
||||
factory PaginationProps.fromQuery(
|
||||
@ -24,6 +26,7 @@ class PaginationProps {
|
||||
isLoading: query.isLoadingNextPage,
|
||||
onFetchMore: query.fetchNext,
|
||||
onFetchAll: onFetchAll,
|
||||
onRefresh: query.refreshAll,
|
||||
);
|
||||
}
|
||||
|
||||
@ -33,7 +36,8 @@ class PaginationProps {
|
||||
other.hasNextPage == hasNextPage &&
|
||||
other.isLoading == isLoading &&
|
||||
other.onFetchMore == onFetchMore &&
|
||||
other.onFetchAll == onFetchAll;
|
||||
other.onFetchAll == onFetchAll &&
|
||||
other.onRefresh == onRefresh;
|
||||
}
|
||||
|
||||
@override
|
||||
@ -42,7 +46,8 @@ class PaginationProps {
|
||||
hasNextPage.hashCode ^
|
||||
isLoading.hashCode ^
|
||||
onFetchMore.hashCode ^
|
||||
onFetchAll.hashCode;
|
||||
onFetchAll.hashCode ^
|
||||
onRefresh.hashCode;
|
||||
}
|
||||
|
||||
class InheritedTrackView extends InheritedWidget {
|
||||
|
@ -31,6 +31,9 @@ class LikedPlaylistPage extends HookConsumerWidget {
|
||||
onFetchAll: () async {
|
||||
return tracks.toList();
|
||||
},
|
||||
onRefresh: () async {
|
||||
await likedTracks.refresh();
|
||||
},
|
||||
),
|
||||
title: playlist.name!,
|
||||
description: playlist.description,
|
||||
|
Loading…
Reference in New Issue
Block a user