fix: content going below bottom player or nav bar

This commit is contained in:
Kingkor Roy Tirtho 2023-03-11 11:58:48 +06:00
parent a0b377104f
commit 1bdce9fe96
11 changed files with 611 additions and 582 deletions

View File

@ -63,11 +63,9 @@ class UserAlbums extends HookConsumerWidget {
}, },
child: SingleChildScrollView( child: SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(), physics: const AlwaysScrollableScrollPhysics(),
child: Material(
type: MaterialType.transparency,
color: Theme.of(context).scaffoldBackgroundColor,
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: SafeArea(
child: Column( child: Column(
children: [ children: [
TextField( TextField(

View File

@ -84,6 +84,7 @@ class UserArtists extends HookConsumerWidget {
onRefresh: () async { onRefresh: () async {
await artistQuery.refreshAll(); await artistQuery.refreshAll();
}, },
child: SafeArea(
child: GridView.builder( child: GridView.builder(
itemCount: filteredArtists.length, itemCount: filteredArtists.length,
physics: const AlwaysScrollableScrollPhysics(), physics: const AlwaysScrollableScrollPhysics(),
@ -96,7 +97,8 @@ class UserArtists extends HookConsumerWidget {
padding: const EdgeInsets.all(10), padding: const EdgeInsets.all(10),
itemBuilder: (context, index) { itemBuilder: (context, index) {
return HookBuilder(builder: (context) { return HookBuilder(builder: (context) {
if (index == artistQuery.pages.length - 1 && hasNextPage) { if (index == artistQuery.pages.length - 1 &&
hasNextPage) {
return Waypoint( return Waypoint(
controller: useScrollController(), controller: useScrollController(),
isGrid: true, isGrid: true,
@ -111,6 +113,7 @@ class UserArtists extends HookConsumerWidget {
}, },
), ),
), ),
),
); );
} }
} }

View File

@ -44,6 +44,7 @@ class UserDownloads extends HookConsumerWidget {
), ),
), ),
Expanded( Expanded(
child: SafeArea(
child: ListView.builder( child: ListView.builder(
itemCount: downloader.inQueue.length, itemCount: downloader.inQueue.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
@ -78,6 +79,7 @@ class UserDownloads extends HookConsumerWidget {
}, },
), ),
), ),
),
], ],
); );
} }

View File

@ -92,10 +92,9 @@ class UserPlaylists extends HookConsumerWidget {
onRefresh: playlistsQuery.refresh, onRefresh: playlistsQuery.refresh,
child: SingleChildScrollView( child: SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(), physics: const AlwaysScrollableScrollPhysics(),
child: Material(
type: MaterialType.transparency,
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: SafeArea(
child: Column( child: Column(
children: [ children: [
TextField( TextField(

View File

@ -260,8 +260,12 @@ class TracksTableView extends HookConsumerWidget {
]; ];
if (isSliver) { if (isSliver) {
return SliverList(delegate: SliverChildListDelegate(children)); return SliverSafeArea(
sliver: SliverList(delegate: SliverChildListDelegate(children)),
);
} }
return ListView(children: children); return SafeArea(
child: ListView(children: children),
);
} }
} }

View File

@ -85,6 +85,7 @@ class ArtistPage extends HookConsumerWidget {
return SingleChildScrollView( return SingleChildScrollView(
controller: parentScrollController, controller: parentScrollController,
padding: const EdgeInsets.all(20), padding: const EdgeInsets.all(20),
child: SafeArea(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -116,7 +117,8 @@ class ArtistPage extends HookConsumerWidget {
horizontal: 10, vertical: 5), horizontal: 10, vertical: 5),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.blue, color: Colors.blue,
borderRadius: BorderRadius.circular(50)), borderRadius:
BorderRadius.circular(50)),
child: Text( child: Text(
data.type!.toUpperCase(), data.type!.toUpperCase(),
style: chipTextVariant?.copyWith( style: chipTextVariant?.copyWith(
@ -163,7 +165,8 @@ class ArtistPage extends HookConsumerWidget {
if (auth != null) if (auth != null)
HookBuilder( HookBuilder(
builder: (context) { builder: (context) {
final isFollowingQuery = useQueries.artist final isFollowingQuery = useQueries
.artist
.doIFollow(ref, artistId); .doIFollow(ref, artistId);
if (isFollowingQuery.isLoading || if (isFollowingQuery.isLoading ||
@ -175,7 +178,8 @@ class ArtistPage extends HookConsumerWidget {
); );
} }
final queryBowl = QueryClient.of(context); final queryBowl =
QueryClient.of(context);
return FilledButton( return FilledButton(
onPressed: () async { onPressed: () async {
@ -217,8 +221,9 @@ class ArtistPage extends HookConsumerWidget {
: Colors.white, : Colors.white,
), ),
style: IconButton.styleFrom( style: IconButton.styleFrom(
backgroundColor: backgroundColor: isBlackListed
isBlackListed ? Colors.red[400] : null, ? Colors.red[400]
: null,
), ),
onPressed: () async { onPressed: () async {
if (isBlackListed) { if (isBlackListed) {
@ -248,7 +253,8 @@ class ArtistPage extends HookConsumerWidget {
text: data.externalUrls?.spotify), text: data.externalUrls?.spotify),
); );
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context)
.showSnackBar(
const SnackBar( const SnackBar(
width: 300, width: 300,
behavior: SnackBarBehavior.floating, behavior: SnackBarBehavior.floating,
@ -280,7 +286,8 @@ class ArtistPage extends HookConsumerWidget {
topTracksQuery.data ?? <Track>[], topTracksQuery.data ?? <Track>[],
); );
if (topTracksQuery.isLoading || !topTracksQuery.hasData) { if (topTracksQuery.isLoading ||
!topTracksQuery.hasData) {
return const CircularProgressIndicator(); return const CircularProgressIndicator();
} else if (topTracksQuery.hasError) { } else if (topTracksQuery.hasError) {
return Center( return Center(
@ -295,8 +302,8 @@ class ArtistPage extends HookConsumerWidget {
currentTrack ??= tracks.first; currentTrack ??= tracks.first;
if (!isPlaylistPlaying) { if (!isPlaylistPlaying) {
playlistNotifier.loadAndPlay(tracks, playlistNotifier.loadAndPlay(tracks,
active: tracks active: tracks.indexWhere(
.indexWhere((s) => s.id == currentTrack?.id)); (s) => s.id == currentTrack?.id));
} else if (isPlaylistPlaying && } else if (isPlaylistPlaying &&
currentTrack.id != null && currentTrack.id != null &&
currentTrack.id != playlist?.activeTrack.id) { currentTrack.id != playlist?.activeTrack.id) {
@ -309,7 +316,8 @@ class ArtistPage extends HookConsumerWidget {
children: [ children: [
Text( Text(
"Top Tracks", "Top Tracks",
style: Theme.of(context).textTheme.headlineSmall, style:
Theme.of(context).textTheme.headlineSmall,
), ),
if (!isPlaylistPlaying) if (!isPlaylistPlaying)
IconButton( IconButton(
@ -339,9 +347,11 @@ class ArtistPage extends HookConsumerWidget {
color: Colors.white, color: Colors.white,
), ),
style: IconButton.styleFrom( style: IconButton.styleFrom(
backgroundColor: Theme.of(context).primaryColor, backgroundColor:
Theme.of(context).primaryColor,
), ),
onPressed: () => playPlaylist(topTracks.toList()), onPressed: () =>
playPlaylist(topTracks.toList()),
) )
], ],
), ),
@ -379,12 +389,14 @@ class ArtistPage extends HookConsumerWidget {
const SizedBox(height: 10), const SizedBox(height: 10),
HookBuilder( HookBuilder(
builder: (context) { builder: (context) {
final relatedArtists = useQueries.artist.relatedArtistsOf( final relatedArtists =
useQueries.artist.relatedArtistsOf(
ref, ref,
artistId, artistId,
); );
if (relatedArtists.isLoading || !relatedArtists.hasData) { if (relatedArtists.isLoading ||
!relatedArtists.hasData) {
return const CircularProgressIndicator(); return const CircularProgressIndicator();
} else if (relatedArtists.hasError) { } else if (relatedArtists.hasError) {
return Center( return Center(
@ -405,6 +417,7 @@ class ArtistPage extends HookConsumerWidget {
), ),
], ],
), ),
),
); );
}, },
), ),

View File

@ -77,7 +77,7 @@ class GenrePage extends HookConsumerWidget {
if (searchText.value.isEmpty && index == categories.length - 1) { if (searchText.value.isEmpty && index == categories.length - 1) {
return const ShimmerCategories(); return const ShimmerCategories();
} }
return CategoryCard(category); return SafeArea(child: CategoryCard(category));
}, },
), ),
), ),

View File

@ -75,6 +75,7 @@ class PersonalizedItemCard extends HookWidget {
child: Waypoint( child: Waypoint(
controller: scrollController, controller: scrollController,
onTouchEdge: hasNextPage ? onFetchMore : null, onTouchEdge: hasNextPage ? onFetchMore : null,
child: SafeArea(
child: ListView( child: ListView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
shrinkWrap: true, shrinkWrap: true,
@ -95,6 +96,7 @@ class PersonalizedItemCard extends HookWidget {
), ),
), ),
), ),
),
], ],
); );
} }

View File

@ -13,10 +13,10 @@ class LibraryPage extends HookConsumerWidget {
const LibraryPage({Key? key}) : super(key: key); const LibraryPage({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context, ref) { Widget build(BuildContext context, ref) {
return const SafeArea( return const DefaultTabController(
bottom: false,
child: DefaultTabController(
length: 5, length: 5,
child: SafeArea(
bottom: false,
child: Scaffold( child: Scaffold(
appBar: PageWindowTitleBar( appBar: PageWindowTitleBar(
centerTitle: true, centerTitle: true,

View File

@ -65,7 +65,6 @@ class SearchPage extends HookConsumerWidget {
bottom: false, bottom: false,
child: Scaffold( child: Scaffold(
appBar: kIsDesktop && !kIsMacOS ? const PageWindowTitleBar() : null, appBar: kIsDesktop && !kIsMacOS ? const PageWindowTitleBar() : null,
extendBody: true,
body: !authenticationNotifier.isLoggedIn body: !authenticationNotifier.isLoggedIn
? const AnonymousFallback() ? const AnonymousFallback()
: Column( : Column(
@ -128,14 +127,16 @@ class SearchPage extends HookConsumerWidget {
vertical: 8, vertical: 8,
horizontal: 20, horizontal: 20,
), ),
child: SafeArea(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
if (tracks.isNotEmpty) if (tracks.isNotEmpty)
Text( Text(
"Songs", "Songs",
style: style: Theme.of(context)
Theme.of(context).textTheme.titleLarge!, .textTheme
.titleLarge!,
), ),
if (searchTrack.isLoadingPage) if (searchTrack.isLoadingPage)
const CircularProgressIndicator() const CircularProgressIndicator()
@ -197,13 +198,14 @@ class SearchPage extends HookConsumerWidget {
if (playlists.isNotEmpty) if (playlists.isNotEmpty)
Text( Text(
"Playlists", "Playlists",
style: style: Theme.of(context)
Theme.of(context).textTheme.titleLarge!, .textTheme
.titleLarge!,
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
ScrollConfiguration( ScrollConfiguration(
behavior: behavior: ScrollConfiguration.of(context)
ScrollConfiguration.of(context).copyWith( .copyWith(
dragDevices: { dragDevices: {
PointerDeviceKind.touch, PointerDeviceKind.touch,
PointerDeviceKind.mouse, PointerDeviceKind.mouse,
@ -227,7 +229,9 @@ class SearchPage extends HookConsumerWidget {
children: [ children: [
...playlists.mapIndexed( ...playlists.mapIndexed(
(i, playlist) { (i, playlist) {
if (i == playlists.length - 1 && if (i ==
playlists.length -
1 &&
searchPlaylist searchPlaylist
.hasNextPage) { .hasNextPage) {
return const ShimmerPlaybuttonCard( return const ShimmerPlaybuttonCard(
@ -254,13 +258,14 @@ class SearchPage extends HookConsumerWidget {
if (artists.isNotEmpty) if (artists.isNotEmpty)
Text( Text(
"Artists", "Artists",
style: style: Theme.of(context)
Theme.of(context).textTheme.titleLarge!, .textTheme
.titleLarge!,
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
ScrollConfiguration( ScrollConfiguration(
behavior: behavior: ScrollConfiguration.of(context)
ScrollConfiguration.of(context).copyWith( .copyWith(
dragDevices: { dragDevices: {
PointerDeviceKind.touch, PointerDeviceKind.touch,
PointerDeviceKind.mouse, PointerDeviceKind.mouse,
@ -281,7 +286,8 @@ class SearchPage extends HookConsumerWidget {
...artists.mapIndexed( ...artists.mapIndexed(
(i, artist) { (i, artist) {
if (i == artists.length - 1 && if (i == artists.length - 1 &&
searchArtist.hasNextPage) { searchArtist
.hasNextPage) {
return const ShimmerPlaybuttonCard( return const ShimmerPlaybuttonCard(
count: 1); count: 1);
} }
@ -317,8 +323,8 @@ class SearchPage extends HookConsumerWidget {
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
ScrollConfiguration( ScrollConfiguration(
behavior: behavior: ScrollConfiguration.of(context)
ScrollConfiguration.of(context).copyWith( .copyWith(
dragDevices: { dragDevices: {
PointerDeviceKind.touch, PointerDeviceKind.touch,
PointerDeviceKind.mouse, PointerDeviceKind.mouse,
@ -359,13 +365,15 @@ class SearchPage extends HookConsumerWidget {
const CircularProgressIndicator(), const CircularProgressIndicator(),
if (searchAlbum.hasPageError) if (searchAlbum.hasPageError)
Text( Text(
searchAlbum.errors.lastOrNull?.toString() ?? searchAlbum.errors.lastOrNull
?.toString() ??
"", "",
), ),
], ],
), ),
), ),
), ),
),
); );
}, },
) )

View File

@ -17,9 +17,9 @@ class AboutSpotube extends HookConsumerWidget {
final packageInfo = usePackageInfo(); final packageInfo = usePackageInfo();
return Scaffold( return Scaffold(
appBar: PageWindowTitleBar( appBar: const PageWindowTitleBar(
leading: const BackButton(), leading: BackButton(),
title: const Text("About Spotube"), title: Text("About Spotube"),
), ),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Padding( child: Padding(