INFRA: Set Up Project.

This commit is contained in:
2025-11-28 11:10:49 +05:00
commit c798279f7d
609 changed files with 77436 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
import 'package:rxdart/rxdart.dart';
enum PlaybackState { pause, play, next, previous }
/// Controller to sync playback between animated child (story) views. This
/// helps make sure when stories are paused, the animation (gifs/slides) are
/// also paused.
/// Another reason for using the controller is to place the stories on `paused`
/// state when a media is loading.
class StoryController {
/// Stream that broadcasts the playback state of the stories.
final playbackNotifier = BehaviorSubject<PlaybackState>();
/// Notify listeners with a [PlaybackState.pause] state
void pause() {
playbackNotifier.add(PlaybackState.pause);
}
/// Notify listeners with a [PlaybackState.play] state
void play() {
playbackNotifier.add(PlaybackState.play);
}
void next() {
playbackNotifier.add(PlaybackState.next);
}
void previous() {
playbackNotifier.add(PlaybackState.previous);
}
/// Remember to call dispose when the story screen is disposed to close
/// the notifier stream.
void dispose() {
playbackNotifier.close();
}
}