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