diff options
Diffstat (limited to 'lib/data/data_providers/mediaplayer_notifier.dart')
-rw-r--r-- | lib/data/data_providers/mediaplayer_notifier.dart | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/data/data_providers/mediaplayer_notifier.dart b/lib/data/data_providers/mediaplayer_notifier.dart new file mode 100644 index 0000000..2d02e75 --- /dev/null +++ b/lib/data/data_providers/mediaplayer_notifier.dart @@ -0,0 +1,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(); + } +} |