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!,
);
if (playlistQuery.hasErrors && !playlistQuery.hasPageData) {
if (playlistQuery.hasErrors &&
!playlistQuery.hasPageData &&
!playlistQuery.isLoadingNextPage) {
return const SizedBox.shrink();
}
final playlists = playlistQuery.pages.expand(

View File

@ -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(

View File

@ -222,7 +222,8 @@ class SearchPage extends HookConsumerWidget {
),
),
if (!searchPlaylist.hasPageData &&
!searchPlaylist.hasPageError)
!searchPlaylist.hasPageError &&
!searchPlaylist.isLoadingNextPage)
const CircularProgressIndicator(),
if (searchPlaylist.hasPageError)
Padding(
@ -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(
@ -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(

View File

@ -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:

View File

@ -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
@ -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