fix: infinite list disappearing for a moment everytime new page is fetched

This commit is contained in:
Kingkor Roy Tirtho 2023-10-29 21:38:48 +06:00
parent 353ca79be3
commit 1334a62aae
5 changed files with 31 additions and 43 deletions

View File

@ -28,7 +28,9 @@ class CategoryCard extends HookConsumerWidget {
category.id!, category.id!,
); );
if (playlistQuery.hasErrors && !playlistQuery.hasPageData) { if (playlistQuery.hasErrors &&
!playlistQuery.hasPageData &&
!playlistQuery.isLoadingNextPage) {
return const SizedBox.shrink(); return const SizedBox.shrink();
} }
final playlists = playlistQuery.pages.expand( final playlists = playlistQuery.pages.expand(

View File

@ -131,7 +131,8 @@ class PersonalizedPage extends HookConsumerWidget {
child: ListView( child: ListView(
controller: controller, controller: controller,
children: [ children: [
if (!featuredPlaylistsQuery.hasPageData) if (!featuredPlaylistsQuery.hasPageData &&
!featuredPlaylistsQuery.isLoadingNextPage)
const ShimmerCategories() const ShimmerCategories()
else else
PersonalizedItemCard( PersonalizedItemCard(

View File

@ -222,7 +222,8 @@ class SearchPage extends HookConsumerWidget {
), ),
), ),
if (!searchPlaylist.hasPageData && if (!searchPlaylist.hasPageData &&
!searchPlaylist.hasPageError) !searchPlaylist.hasPageError &&
!searchPlaylist.isLoadingNextPage)
const CircularProgressIndicator(), const CircularProgressIndicator(),
if (searchPlaylist.hasPageError) if (searchPlaylist.hasPageError)
Padding( Padding(
@ -280,7 +281,9 @@ class SearchPage extends HookConsumerWidget {
), ),
), ),
), ),
if (!searchArtist.hasPageData && !searchArtist.hasPageError) if (!searchArtist.hasPageData &&
!searchArtist.hasPageError &&
!searchArtist.isLoadingNextPage)
const CircularProgressIndicator(), const CircularProgressIndicator(),
if (searchArtist.hasPageError) if (searchArtist.hasPageError)
Padding( Padding(
@ -336,7 +339,9 @@ class SearchPage extends HookConsumerWidget {
), ),
), ),
), ),
if (!searchAlbum.hasPageData && !searchAlbum.hasPageError) if (!searchAlbum.hasPageData &&
!searchAlbum.hasPageError &&
!searchAlbum.isLoadingNextPage)
const CircularProgressIndicator(), const CircularProgressIndicator(),
if (searchAlbum.hasPageError) if (searchAlbum.hasPageError)
Padding( Padding(

View File

@ -596,30 +596,27 @@ packages:
fl_query: fl_query:
dependency: "direct main" dependency: "direct main"
description: description:
path: "packages/fl_query" name: fl_query
ref: HEAD sha256: daee5ab0ed8899baa201b89b5813107df5258144a9e2bcf192dbcf922c57d985
resolved-ref: a817713a0bb0c486e908e9ed74467c4f7f58bea7 url: "https://pub.dev"
url: "https://github.com/KRTirtho/fl-query.git" source: hosted
source: git version: "1.0.0"
version: "1.0.0-alpha.5"
fl_query_devtools: fl_query_devtools:
dependency: "direct main" dependency: "direct main"
description: description:
path: "packages/fl_query_devtools" name: fl_query_devtools
ref: HEAD sha256: "2ae8905fd4a95f1d245a1b54057c31c8d27fc961223bcb7ce13088bcf6595059"
resolved-ref: a817713a0bb0c486e908e9ed74467c4f7f58bea7 url: "https://pub.dev"
url: "https://github.com/KRTirtho/fl-query.git" source: hosted
source: git version: "0.1.0"
version: "0.1.0-alpha.3"
fl_query_hooks: fl_query_hooks:
dependency: "direct main" dependency: "direct main"
description: description:
path: "packages/fl_query_hooks" name: fl_query_hooks
ref: HEAD sha256: "6c88b3bfbdc3e1330931b927903929d7351f86fc63266ac93b3acb9f133a09a9"
resolved-ref: a817713a0bb0c486e908e9ed74467c4f7f58bea7 url: "https://pub.dev"
url: "https://github.com/KRTirtho/fl-query.git" source: hosted
source: git version: "1.0.0"
version: "1.0.0-alpha.5"
fluentui_system_icons: fluentui_system_icons:
dependency: "direct main" dependency: "direct main"
description: description:

View File

@ -32,18 +32,9 @@ dependencies:
duration: ^3.0.12 duration: ^3.0.12
envied: ^0.3.0 envied: ^0.3.0
file_selector: ^1.0.1 file_selector: ^1.0.1
fl_query: fl_query: ^1.0.0
git: fl_query_hooks: ^1.0.0
url: https://github.com/KRTirtho/fl-query.git fl_query_devtools: ^0.1.0
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
fluentui_system_icons: ^1.1.189 fluentui_system_icons: ^1.1.189
flutter: flutter:
sdk: flutter sdk: flutter
@ -135,14 +126,6 @@ dev_dependencies:
dependency_overrides: dependency_overrides:
http: ^1.1.0 http: ^1.1.0
system_tray: 2.0.2 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: flutter:
generate: true generate: true