mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
21 lines
602 B
Dart
21 lines
602 B
Dart
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:spotube/provider/playback_provider.dart';
|
|
|
|
Future<void> Function() useNextTrack(WidgetRef ref) {
|
|
return () async {
|
|
final playback = ref.read(playbackProvider);
|
|
await playback.player.pause();
|
|
await playback.player.seek(Duration.zero);
|
|
playback.seekForward();
|
|
};
|
|
}
|
|
|
|
Future<void> Function() usePreviousTrack(WidgetRef ref) {
|
|
return () async {
|
|
final playback = ref.read(playbackProvider);
|
|
await playback.player.pause();
|
|
await playback.player.seek(Duration.zero);
|
|
playback.seekBackward();
|
|
};
|
|
}
|