Skip to content

Commit

Permalink
fix: infinite list disappearing for a moment everytime new page is fe…
Browse files Browse the repository at this point in the history
…tched
  • Loading branch information
KRTirtho committed Oct 29, 2023
1 parent 353ca79 commit 1334a62
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 43 deletions.
4 changes: 3 additions & 1 deletion lib/components/genre/category_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ class CategoryCard extends HookConsumerWidget {
category.id!,
);

if (playlistQuery.hasErrors && !playlistQuery.hasPageData) {
if (playlistQuery.hasErrors &&
!playlistQuery.hasPageData &&
!playlistQuery.isLoadingNextPage) {
return const SizedBox.shrink();
}
final playlists = playlistQuery.pages.expand(
Expand Down
3 changes: 2 additions & 1 deletion lib/pages/home/personalized.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ class PersonalizedPage extends HookConsumerWidget {
child: ListView(
controller: controller,
children: [
if (!featuredPlaylistsQuery.hasPageData)
if (!featuredPlaylistsQuery.hasPageData &&
!featuredPlaylistsQuery.isLoadingNextPage)
const ShimmerCategories()
else
PersonalizedItemCard(
Expand Down
11 changes: 8 additions & 3 deletions lib/pages/search/search.dart
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ class SearchPage extends HookConsumerWidget {
),
),
if (!searchPlaylist.hasPageData &&
!searchPlaylist.hasPageError)
!searchPlaylist.hasPageError &&
!searchPlaylist.isLoadingNextPage)
const CircularProgressIndicator(),
if (searchPlaylist.hasPageError)
Padding(
Expand Down Expand Up @@ -280,7 +281,9 @@ class SearchPage extends HookConsumerWidget {
),
),
),
if (!searchArtist.hasPageData && !searchArtist.hasPageError)
if (!searchArtist.hasPageData &&
!searchArtist.hasPageError &&
!searchArtist.isLoadingNextPage)
const CircularProgressIndicator(),
if (searchArtist.hasPageError)
Padding(
Expand Down Expand Up @@ -336,7 +339,9 @@ class SearchPage extends HookConsumerWidget {
),
),
),
if (!searchAlbum.hasPageData && !searchAlbum.hasPageError)
if (!searchAlbum.hasPageData &&
!searchAlbum.hasPageError &&
!searchAlbum.isLoadingNextPage)
const CircularProgressIndicator(),
if (searchAlbum.hasPageError)
Padding(
Expand Down
33 changes: 15 additions & 18 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -596,30 +596,27 @@ packages:
fl_query:
dependency: "direct main"
description:
path: "packages/fl_query"
ref: HEAD
resolved-ref: a817713a0bb0c486e908e9ed74467c4f7f58bea7
url: "https://github.com/KRTirtho/fl-query.git"
source: git
version: "1.0.0-alpha.5"
name: fl_query
sha256: daee5ab0ed8899baa201b89b5813107df5258144a9e2bcf192dbcf922c57d985
url: "https://pub.dev"
source: hosted
version: "1.0.0"
fl_query_devtools:
dependency: "direct main"
description:
path: "packages/fl_query_devtools"
ref: HEAD
resolved-ref: a817713a0bb0c486e908e9ed74467c4f7f58bea7
url: "https://github.com/KRTirtho/fl-query.git"
source: git
version: "0.1.0-alpha.3"
name: fl_query_devtools
sha256: "2ae8905fd4a95f1d245a1b54057c31c8d27fc961223bcb7ce13088bcf6595059"
url: "https://pub.dev"
source: hosted
version: "0.1.0"
fl_query_hooks:
dependency: "direct main"
description:
path: "packages/fl_query_hooks"
ref: HEAD
resolved-ref: a817713a0bb0c486e908e9ed74467c4f7f58bea7
url: "https://github.com/KRTirtho/fl-query.git"
source: git
version: "1.0.0-alpha.5"
name: fl_query_hooks
sha256: "6c88b3bfbdc3e1330931b927903929d7351f86fc63266ac93b3acb9f133a09a9"
url: "https://pub.dev"
source: hosted
version: "1.0.0"
fluentui_system_icons:
dependency: "direct main"
description:
Expand Down
23 changes: 3 additions & 20 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,9 @@ dependencies:
duration: ^3.0.12
envied: ^0.3.0
file_selector: ^1.0.1
fl_query:
git:
url: https://github.com/KRTirtho/fl-query.git
path: packages/fl_query
fl_query_hooks:
git:
url: https://github.com/KRTirtho/fl-query.git
path: packages/fl_query_hooks
fl_query_devtools:
git:
url: https://github.com/KRTirtho/fl-query.git
path: packages/fl_query_devtools
fl_query: ^1.0.0
fl_query_hooks: ^1.0.0
fl_query_devtools: ^0.1.0
fluentui_system_icons: ^1.1.189
flutter:
sdk: flutter
Expand Down Expand Up @@ -135,14 +126,6 @@ dev_dependencies:
dependency_overrides:
http: ^1.1.0
system_tray: 2.0.2
fl_query:
git:
url: https://github.com/KRTirtho/fl-query.git
path: packages/fl_query
fl_query_hooks:
git:
url: https://github.com/KRTirtho/fl-query.git
path: packages/fl_query_hooks

flutter:
generate: true
Expand Down

0 comments on commit 1334a62

Please sign in to comment.