summaryrefslogtreecommitdiffstats
path: root/lib/data/data_providers/mediaplayer_notifier.dart
blob: bb121c0124cb12d1aabf540d286b5e501b510216 (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 const 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 = const MediaPlayerState.initial();
  }
}