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( style: defaultTextStyle.style.copyWith(
color: palette.bodyTextColor, color: palette.bodyTextColor,
), ),
textAlign: mediaQuery.mdAndDown
? TextAlign.center
: TextAlign.start,
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),

View File

@ -105,9 +105,9 @@ class TrackViewHeaderButtons extends HookConsumerWidget {
dimension: isActive || isLoading.value ? 0 : null, dimension: isActive || isLoading.value ? 0 : null,
child: FilledButton.icon( child: FilledButton.icon(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: Colors.white, backgroundColor: Colors.white,
foregroundColor: Colors.black, foregroundColor: Colors.black,
), minimumSize: const Size(150, 40)),
label: Text(context.l10n.shuffle), label: Text(context.l10n.shuffle),
icon: const Icon(SpotubeIcons.shuffle), icon: const Icon(SpotubeIcons.shuffle),
onPressed: props.tracks.isEmpty ? null : onShuffle, onPressed: props.tracks.isEmpty ? null : onShuffle,
@ -118,9 +118,9 @@ class TrackViewHeaderButtons extends HookConsumerWidget {
const Gap(10), const Gap(10),
FilledButton.icon( FilledButton.icon(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: color.color, backgroundColor: color.color,
foregroundColor: color.bodyTextColor, foregroundColor: color.bodyTextColor,
), minimumSize: const Size(150, 40)),
onPressed: isActive || props.tracks.isEmpty || isLoading.value onPressed: isActive || props.tracks.isEmpty || isLoading.value
? null ? null
: onPlay, : onPlay,

View File

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