aboutsummaryrefslogtreecommitdiffstats
path: root/lib/data/data_providers/mediaplayer_notifier.dart
blob: 2d02e7535bb4aa3e8181a6a3378893a34b475376 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import 'package:flutter_ics_homescreen/export.dart';
import 'playlist_notifier.dart';

class MediaPlayerStateNotifier extends Notifier<MediaPlayerState> {
  @override
  MediaPlayerState build() {
    return MediaPlayerState.initial();
  }

  void updatePlayState(PlayState newState) {
    state = state.copyWith(playState: newState);
  }

  void updatePlaylistPosition(int position) {
    state = state.copyWith(playlistPosition: position);
  }

  void updateCurrent(PlaylistEntry song) {
    state = state.copyWith(song: song, playlistPosition: song.position);
  }

  void reset() {
    state = MediaPlayerState.initial();
  }
}