mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-12 23:45:18 +00:00
chore: add back pull down to refresh
This commit is contained in:
parent
c82b68a513
commit
30bf0bed62
@ -40,6 +40,8 @@ class PlaybuttonView extends StatelessWidget {
|
||||
final VoidCallback onRequestMore;
|
||||
final ScrollController controller;
|
||||
|
||||
final Widget? leading;
|
||||
|
||||
const PlaybuttonView({
|
||||
super.key,
|
||||
required this.itemCount,
|
||||
@ -49,6 +51,7 @@ class PlaybuttonView extends StatelessWidget {
|
||||
required this.isLoading,
|
||||
required this.onRequestMore,
|
||||
required this.controller,
|
||||
this.leading,
|
||||
});
|
||||
|
||||
@override
|
||||
@ -74,6 +77,7 @@ class PlaybuttonView extends StatelessWidget {
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
if (leading != null) leading!,
|
||||
Toggle(
|
||||
value: isGrid.value,
|
||||
style:
|
||||
|
@ -224,6 +224,11 @@ class Spotube extends HookConsumerWidget {
|
||||
surfaceBlur: 10,
|
||||
),
|
||||
materialTheme: material.ThemeData(
|
||||
brightness: switch (themeMode) {
|
||||
ThemeMode.system => MediaQuery.platformBrightnessOf(context),
|
||||
ThemeMode.light => Brightness.light,
|
||||
ThemeMode.dark => Brightness.dark,
|
||||
},
|
||||
splashFactory: material.NoSplash.splashFactory,
|
||||
appBarTheme: const material.AppBarTheme(
|
||||
surfaceTintColor: Colors.transparent,
|
||||
|
@ -52,6 +52,7 @@ class ConnectPageLocalDevices extends HookWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
const SliverGap(200)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:flutter/material.dart' as material;
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:shadcn_flutter/shadcn_flutter.dart';
|
||||
@ -27,7 +28,13 @@ class AlbumPage extends HookConsumerWidget {
|
||||
final favoriteAlbumsNotifier = ref.watch(favoriteAlbumsProvider.notifier);
|
||||
final isSavedAlbum = ref.watch(albumsIsSavedProvider(album.id!));
|
||||
|
||||
return TrackPresentation(
|
||||
return material.RefreshIndicator.adaptive(
|
||||
onRefresh: () async {
|
||||
ref.invalidate(albumTracksProvider(album));
|
||||
ref.invalidate(favoriteAlbumsProvider);
|
||||
ref.invalidate(albumsIsSavedProvider(album.id!));
|
||||
},
|
||||
child: TrackPresentation(
|
||||
options: TrackPresentationOptions(
|
||||
collection: album,
|
||||
image: album.images.asUrlString(
|
||||
@ -66,6 +73,7 @@ class AlbumPage extends HookConsumerWidget {
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:flutter/material.dart' as material;
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:shadcn_flutter/shadcn_flutter.dart';
|
||||
@ -42,6 +43,18 @@ class ArtistPage extends HookConsumerWidget {
|
||||
)
|
||||
],
|
||||
floatingHeader: true,
|
||||
child: material.RefreshIndicator.adaptive(
|
||||
onRefresh: () async {
|
||||
ref.invalidate(artistProvider(artistId));
|
||||
ref.invalidate(relatedArtistsProvider(artistId));
|
||||
ref.invalidate(artistAlbumsProvider(artistId));
|
||||
ref.invalidate(artistIsFollowingProvider(artistId));
|
||||
ref.invalidate(artistTopTracksProvider(artistId));
|
||||
if (artistQuery.hasValue) {
|
||||
ref.invalidate(
|
||||
artistWikipediaSummaryProvider(artistQuery.asData!.value));
|
||||
}
|
||||
},
|
||||
child: Builder(builder: (context) {
|
||||
if (artistQuery.hasError && artistQuery.asData?.value == null) {
|
||||
return Center(child: Text(artistQuery.error.toString()));
|
||||
@ -74,7 +87,8 @@ class ArtistPage extends HookConsumerWidget {
|
||||
const SliverGap(20),
|
||||
if (artistQuery.asData?.value != null)
|
||||
SliverToBoxAdapter(
|
||||
child: ArtistPageFooter(artist: artistQuery.asData!.value),
|
||||
child:
|
||||
ArtistPageFooter(artist: artistQuery.asData!.value),
|
||||
),
|
||||
const SliverSafeArea(sliver: SliverGap(10)),
|
||||
],
|
||||
@ -82,6 +96,7 @@ class ArtistPage extends HookConsumerWidget {
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -69,6 +69,13 @@ class LibraryPage extends HookConsumerWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
else
|
||||
const TitleBar(
|
||||
automaticallyImplyLeading: false,
|
||||
backgroundColor: Colors.transparent,
|
||||
surfaceBlur: 0,
|
||||
height: 32,
|
||||
),
|
||||
const Gap(10),
|
||||
],
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:flutter/material.dart' as material;
|
||||
import 'package:flutter_undraw/flutter_undraw.dart';
|
||||
import 'package:shadcn_flutter/shadcn_flutter.dart' hide Image;
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
@ -55,10 +56,10 @@ class UserAlbumsPage extends HookConsumerWidget {
|
||||
return SafeArea(
|
||||
bottom: false,
|
||||
child: Scaffold(
|
||||
child: RefreshTrigger(
|
||||
// onRefresh: () async {
|
||||
// ref.invalidate(favoriteAlbumsProvider);
|
||||
// },
|
||||
child: material.RefreshIndicator.adaptive(
|
||||
onRefresh: () async {
|
||||
ref.invalidate(favoriteAlbumsProvider);
|
||||
},
|
||||
child: InterScrollbar(
|
||||
controller: controller,
|
||||
child: CustomScrollView(
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:flutter/material.dart' as material;
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter_undraw/flutter_undraw.dart';
|
||||
@ -60,10 +61,10 @@ class UserArtistsPage extends HookConsumerWidget {
|
||||
return SafeArea(
|
||||
bottom: false,
|
||||
child: Scaffold(
|
||||
child: RefreshTrigger(
|
||||
// onRefresh: () async {
|
||||
// ref.invalidate(followedArtistsProvider);
|
||||
// },
|
||||
child: material.RefreshIndicator.adaptive(
|
||||
onRefresh: () async {
|
||||
ref.invalidate(followedArtistsProvider);
|
||||
},
|
||||
child: InterScrollbar(
|
||||
controller: controller,
|
||||
child: Padding(
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart' as material;
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
@ -342,9 +343,9 @@ class LocalLibraryPage extends HookConsumerWidget {
|
||||
}
|
||||
|
||||
return Expanded(
|
||||
child: RefreshTrigger(
|
||||
child: material.RefreshIndicator.adaptive(
|
||||
onRefresh: () async {
|
||||
// ref.invalidate(localTracksProvider);
|
||||
ref.invalidate(localTracksProvider);
|
||||
},
|
||||
child: InterScrollbar(
|
||||
controller: controller,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import 'package:flutter/material.dart' show kToolbarHeight;
|
||||
import 'package:flutter/material.dart' as material;
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:fuzzywuzzy/fuzzywuzzy.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
@ -17,7 +17,6 @@ import 'package:spotube/modules/playlist/playlist_card.dart';
|
||||
import 'package:spotube/extensions/context.dart';
|
||||
import 'package:spotube/provider/authentication/authentication.dart';
|
||||
import 'package:spotube/provider/spotify/spotify.dart';
|
||||
import 'package:spotube/utils/platform.dart';
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
|
||||
@RoutePage()
|
||||
@ -79,10 +78,10 @@ class UserPlaylistsPage extends HookConsumerWidget {
|
||||
return const AnonymousFallback();
|
||||
}
|
||||
|
||||
return RefreshTrigger(
|
||||
// onRefresh: () async {
|
||||
// ref.invalidate(favoritePlaylistsProvider);
|
||||
// },
|
||||
return material.RefreshIndicator.adaptive(
|
||||
onRefresh: () async {
|
||||
ref.invalidate(favoritePlaylistsProvider);
|
||||
},
|
||||
child: SafeArea(
|
||||
bottom: false,
|
||||
child: InterScrollbar(
|
||||
@ -103,12 +102,14 @@ class UserPlaylistsPage extends HookConsumerWidget {
|
||||
leading: const Icon(SpotubeIcons.filter),
|
||||
),
|
||||
),
|
||||
bottom: PreferredSize(
|
||||
preferredSize:
|
||||
Size.fromHeight(kIsDesktop ? 35 : kToolbarHeight),
|
||||
),
|
||||
const SliverGap(10),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
sliver: PlaybuttonView(
|
||||
leading: Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
const Gap(10),
|
||||
const PlaylistCreateDialogButton(),
|
||||
const Gap(10),
|
||||
Button.primary(
|
||||
@ -122,11 +123,6 @@ class UserPlaylistsPage extends HookConsumerWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SliverGap(10),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
sliver: PlaybuttonView(
|
||||
controller: controller,
|
||||
hasMore: playlistsQuery.asData?.value.hasMore == true,
|
||||
isLoading: playlistsQuery.isLoading,
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:flutter/material.dart' as material;
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:spotify/spotify.dart';
|
||||
@ -22,7 +23,11 @@ class LikedPlaylistPage extends HookConsumerWidget {
|
||||
final likedTracks = ref.watch(likedTracksProvider);
|
||||
final tracks = likedTracks.asData?.value ?? <Track>[];
|
||||
|
||||
return TrackPresentation(
|
||||
return material.RefreshIndicator.adaptive(
|
||||
onRefresh: () async {
|
||||
ref.invalidate(likedTracksProvider);
|
||||
},
|
||||
child: TrackPresentation(
|
||||
options: TrackPresentationOptions(
|
||||
collection: playlist,
|
||||
image: "assets/liked-tracks.jpg",
|
||||
@ -46,6 +51,7 @@ class LikedPlaylistPage extends HookConsumerWidget {
|
||||
onHeart: null,
|
||||
owner: playlist.owner?.displayName,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:flutter/material.dart' as material;
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/material.dart' hide Page;
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
@ -49,7 +50,13 @@ class PlaylistPage extends HookConsumerWidget {
|
||||
|
||||
final isUserPlaylist = useIsUserPlaylist(ref, playlist.id!);
|
||||
|
||||
return TrackPresentation(
|
||||
return material.RefreshIndicator.adaptive(
|
||||
onRefresh: () async {
|
||||
ref.invalidate(playlistTracksProvider(playlist.id!));
|
||||
ref.invalidate(isFavoritePlaylistProvider(playlist.id!));
|
||||
ref.invalidate(favoritePlaylistsProvider);
|
||||
},
|
||||
child: TrackPresentation(
|
||||
options: TrackPresentationOptions(
|
||||
collection: playlist,
|
||||
image: playlist.images.asUrlString(
|
||||
@ -95,6 +102,7 @@ class PlaylistPage extends HookConsumerWidget {
|
||||
return isUserPlaylist;
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -111,7 +111,9 @@ class TrackPage extends HookConsumerWidget {
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
runAlignment: WrapAlignment.center,
|
||||
children: [
|
||||
ClipRRect(
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 20),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: UniversalImage(
|
||||
path: track.album!.images.asUrlString(
|
||||
@ -121,6 +123,7 @@ class TrackPage extends HookConsumerWidget {
|
||||
width: 200,
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
|
@ -376,7 +376,7 @@ packages:
|
||||
source: hosted
|
||||
version: "4.10.1"
|
||||
collection:
|
||||
dependency: "direct overridden"
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: collection
|
||||
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
|
||||
|
@ -144,6 +144,7 @@ dependencies:
|
||||
git:
|
||||
url: https://github.com/KRTirtho/flutter_new_pipe_extractor.git
|
||||
http_parser: ^4.1.2
|
||||
collection: any
|
||||
|
||||
dev_dependencies:
|
||||
build_runner: ^2.4.13
|
||||
|
Loading…
Reference in New Issue
Block a user