From 92deb0cc6ac8ad781377fb99e1f49dec1519a716 Mon Sep 17 00:00:00 2001 From: Kingkor Roy Tirtho Date: Wed, 22 Nov 2023 08:55:42 +0600 Subject: [PATCH] chore: fix playbutton not playing anything --- .../tracks_view/sections/header/flexible_header.dart | 3 +++ .../tracks_view/sections/header/header_buttons.dart | 12 ++++++------ lib/extensions/infinite_query.dart | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/components/shared/tracks_view/sections/header/flexible_header.dart b/lib/components/shared/tracks_view/sections/header/flexible_header.dart index 57089975..7c469654 100644 --- a/lib/components/shared/tracks_view/sections/header/flexible_header.dart +++ b/lib/components/shared/tracks_view/sections/header/flexible_header.dart @@ -119,6 +119,9 @@ class TrackViewFlexHeader extends HookConsumerWidget { style: defaultTextStyle.style.copyWith( color: palette.bodyTextColor, ), + textAlign: mediaQuery.mdAndDown + ? TextAlign.center + : TextAlign.start, maxLines: 2, overflow: TextOverflow.ellipsis, ), diff --git a/lib/components/shared/tracks_view/sections/header/header_buttons.dart b/lib/components/shared/tracks_view/sections/header/header_buttons.dart index c006ec08..bae47f12 100644 --- a/lib/components/shared/tracks_view/sections/header/header_buttons.dart +++ b/lib/components/shared/tracks_view/sections/header/header_buttons.dart @@ -105,9 +105,9 @@ class TrackViewHeaderButtons extends HookConsumerWidget { dimension: isActive || isLoading.value ? 0 : null, child: FilledButton.icon( style: ElevatedButton.styleFrom( - backgroundColor: Colors.white, - foregroundColor: Colors.black, - ), + backgroundColor: Colors.white, + foregroundColor: Colors.black, + minimumSize: const Size(150, 40)), label: Text(context.l10n.shuffle), icon: const Icon(SpotubeIcons.shuffle), onPressed: props.tracks.isEmpty ? null : onShuffle, @@ -118,9 +118,9 @@ class TrackViewHeaderButtons extends HookConsumerWidget { const Gap(10), FilledButton.icon( style: ElevatedButton.styleFrom( - backgroundColor: color.color, - foregroundColor: color.bodyTextColor, - ), + backgroundColor: color.color, + foregroundColor: color.bodyTextColor, + minimumSize: const Size(150, 40)), onPressed: isActive || props.tracks.isEmpty || isLoading.value ? null : onPlay, diff --git a/lib/extensions/infinite_query.dart b/lib/extensions/infinite_query.dart index 86a2aaa6..90dcf73e 100644 --- a/lib/extensions/infinite_query.dart +++ b/lib/extensions/infinite_query.dart @@ -5,7 +5,7 @@ extension FetchAllTracks on InfiniteQuery, dynamic, int> { Future> fetchAllTracks({ required Future> Function() getAllTracks, }) async { - if (!hasNextPage) { + if (pages.isNotEmpty && !hasNextPage) { return pages.expand((page) => page).toList(); } final tracks = await getAllTracks();