chore: update fl_query & add support

This commit is contained in:
Kingkor Roy Tirtho 2023-10-07 12:15:28 +06:00
parent b7521a9021
commit 1f15b6720f
4 changed files with 35 additions and 27 deletions

View File

@ -105,8 +105,9 @@ class UserPlaylists extends HookConsumerWidget {
), ),
AnimatedCrossFade( AnimatedCrossFade(
duration: const Duration(milliseconds: 300), duration: const Duration(milliseconds: 300),
crossFadeState: playlistsQuery.isLoadingPage || crossFadeState: !playlistsQuery.hasPageData &&
!playlistsQuery.hasPageData !playlistsQuery.hasPageError &&
!playlistsQuery.isLoadingNextPage
? CrossFadeState.showFirst ? CrossFadeState.showFirst
: CrossFadeState.showSecond, : CrossFadeState.showSecond,
firstChild: firstChild:

View File

@ -72,7 +72,10 @@ class SearchPage extends HookConsumerWidget {
final queries = [searchTrack, searchAlbum, searchPlaylist, searchArtist]; final queries = [searchTrack, searchAlbum, searchPlaylist, searchArtist];
final isFetching = queries.every( final isFetching = queries.every(
(s) => s.isLoadingPage || s.isRefreshingPage || !s.hasPageData, (s) =>
(!s.hasPageData && !s.hasPageError) ||
s.isRefreshingPage ||
!s.hasPageData,
) && ) &&
searchTerm.isNotEmpty; searchTerm.isNotEmpty;
@ -120,7 +123,9 @@ class SearchPage extends HookConsumerWidget {
style: theme.textTheme.titleLarge!, style: theme.textTheme.titleLarge!,
), ),
), ),
if (searchTrack.isLoadingPage) if (!searchTrack.hasPageData &&
!searchTrack.hasPageError &&
!searchTrack.isLoadingNextPage)
const CircularProgressIndicator() const CircularProgressIndicator()
else if (searchTrack.hasPageError) else if (searchTrack.hasPageError)
Text( Text(
@ -160,10 +165,10 @@ class SearchPage extends HookConsumerWidget {
if (searchTrack.hasNextPage && tracks.isNotEmpty) if (searchTrack.hasNextPage && tracks.isNotEmpty)
Center( Center(
child: TextButton( child: TextButton(
onPressed: searchTrack.isRefreshingPage onPressed: searchTrack.isLoadingNextPage
? null ? null
: () => searchTrack.fetchNext(), : () => searchTrack.fetchNext(),
child: searchTrack.isRefreshingPage child: searchTrack.isLoadingNextPage
? const CircularProgressIndicator() ? const CircularProgressIndicator()
: Text(context.l10n.load_more), : Text(context.l10n.load_more),
), ),
@ -216,7 +221,8 @@ class SearchPage extends HookConsumerWidget {
), ),
), ),
), ),
if (searchPlaylist.isLoadingPage) if (!searchPlaylist.hasPageData &&
!searchPlaylist.hasPageError)
const CircularProgressIndicator(), const CircularProgressIndicator(),
if (searchPlaylist.hasPageError) if (searchPlaylist.hasPageError)
Padding( Padding(
@ -274,7 +280,7 @@ class SearchPage extends HookConsumerWidget {
), ),
), ),
), ),
if (searchArtist.isLoadingPage) if (!searchArtist.hasPageData && !searchArtist.hasPageError)
const CircularProgressIndicator(), const CircularProgressIndicator(),
if (searchArtist.hasPageError) if (searchArtist.hasPageError)
Padding( Padding(
@ -330,7 +336,7 @@ class SearchPage extends HookConsumerWidget {
), ),
), ),
), ),
if (searchAlbum.isLoadingPage) if (!searchAlbum.hasPageData && !searchAlbum.hasPageError)
const CircularProgressIndicator(), const CircularProgressIndicator(),
if (searchAlbum.hasPageError) if (searchAlbum.hasPageError)
Padding( Padding(
@ -363,7 +369,8 @@ class SearchPage extends HookConsumerWidget {
), ),
color: theme.scaffoldBackgroundColor, color: theme.scaffoldBackgroundColor,
child: TextField( child: TextField(
autofocus: queries.none((s) => s.hasPageData), autofocus:
queries.none((s) => s.hasPageData && !s.hasPageError),
decoration: InputDecoration( decoration: InputDecoration(
prefixIcon: const Icon(SpotubeIcons.search), prefixIcon: const Icon(SpotubeIcons.search),
hintText: "${context.l10n.search}...", hintText: "${context.l10n.search}...",

View File

@ -581,26 +581,26 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: fl_query name: fl_query
sha256: "3d71cd1eeb3232efa5e32363a351d74fd9ff07c6eb80aeb672b1970962764945" sha256: a97bd9234c3e8aefe43735d0ac6b7153154ea7aeeac123b0621afb0e4dca3291
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.0-alpha.4" version: "1.0.0-alpha.5"
fl_query_devtools: fl_query_devtools:
dependency: "direct main" dependency: "direct main"
description: description:
name: fl_query_devtools name: fl_query_devtools
sha256: "72fac45293902b9f99c726609cd5416573566cce0b7c6e27311efde7fdf1b8b1" sha256: e827512a8601ba57272a9171581e789ffb68375a8a86c994750b45f8cdc0a993
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.1.0-alpha.2" version: "0.1.0-alpha.3"
fl_query_hooks: fl_query_hooks:
dependency: "direct main" dependency: "direct main"
description: description:
name: fl_query_hooks name: fl_query_hooks
sha256: "7f0880696666714f77981777509a8aedb765857dcdbdde23e623da20a24c4ae0" sha256: "97ad03d0d2d506353d8f3de62ac2aa0b465d85827d15641e3e4b76b16e0a5bbd"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.0-alpha.4+1" version: "1.0.0-alpha.5"
fluentui_system_icons: fluentui_system_icons:
dependency: "direct main" dependency: "direct main"
description: description:
@ -821,10 +821,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: flutter_rust_bridge name: flutter_rust_bridge
sha256: a2ff791f96ed03be0d4a8d249130688371ab3612ef95efeddef23600b904a1ef sha256: e12415c3bce49bcbc3fed383f0ea41ad7d828f6cf0eccba0588ffa5a812fe522
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.81.0" version: "1.82.1"
flutter_secure_storage: flutter_secure_storage:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1337,10 +1337,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: metadata_god name: metadata_god
sha256: "562c223d83a7bbf0a289ed0d5ed6a8cf8d94d673263203e9ff4930b44bd2f066" sha256: cf13931c39eba0b9443d16e8940afdabee125bf08945f18d4c0d02bcae2a3317
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.5.0" version: "0.5.2+1"
mime: mime:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1839,10 +1839,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: smtc_windows name: smtc_windows
sha256: dd86d0f29b5a73ffed5650279e6abee01846017b9bc16c07c708e129648c08ac sha256: aba2bad5ddfaf595496db04df3d9fdb54fb128fc1f39c8f024945a67455388fe
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.1.0" version: "0.1.1"
source_gen: source_gen:
dependency: transitive dependency: transitive
description: description:

View File

@ -32,9 +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: ^1.0.0-alpha.4 fl_query: ^1.0.0-alpha.5
fl_query_hooks: ^1.0.0-alpha.4+1 fl_query_hooks: ^1.0.0-alpha.5
fl_query_devtools: ^0.1.0-alpha.2 fl_query_devtools: ^0.1.0-alpha.3
fluentui_system_icons: ^1.1.189 fluentui_system_icons: ^1.1.189
flutter: flutter:
sdk: flutter sdk: flutter
@ -70,7 +70,7 @@ dependencies:
logger: ^2.0.2 logger: ^2.0.2
media_kit: ^1.1.3 media_kit: ^1.1.3
media_kit_libs_audio: ^1.0.1 media_kit_libs_audio: ^1.0.1
metadata_god: ^0.5.0 metadata_god: ^0.5.2+1
mime: ^1.0.2 mime: ^1.0.2
package_info_plus: ^4.1.0 package_info_plus: ^4.1.0
palette_generator: ^0.3.3 palette_generator: ^0.3.3
@ -87,7 +87,7 @@ dependencies:
shared_preferences: ^2.0.11 shared_preferences: ^2.0.11
sidebarx: ^0.15.0 sidebarx: ^0.15.0
skeleton_text: ^3.0.1 skeleton_text: ^3.0.1
smtc_windows: ^0.1.0 smtc_windows: ^0.1.1
spotify: ^0.12.0 spotify: ^0.12.0
stroke_text: ^0.0.2 stroke_text: ^0.0.2
supabase: ^1.9.9 supabase: ^1.9.9