chore: fix playbutton not playing anything

This commit is contained in:
Kingkor Roy Tirtho 2023-11-22 08:55:42 +06:00
parent 98aff8f3b9
commit 92deb0cc6a
3 changed files with 10 additions and 7 deletions

View File

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

View File

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

View File

@ -5,7 +5,7 @@ extension FetchAllTracks on InfiniteQuery<List<Track>, dynamic, int> {
Future<List<Track>> fetchAllTracks({
required Future<List<Track>> Function() getAllTracks,
}) async {
if (!hasNextPage) {
if (pages.isNotEmpty && !hasNextPage) {
return pages.expand((page) => page).toList();
}
final tracks = await getAllTracks();