Comment on page
AdvStoryController
This page contains infromation of AdvStoryController properties.
Provides methods for manipulating
AdvStory
default flow and for listening events. // Define controller in your code
final controller = AdvStoryController();
...
AdvStory(
controller: controller,
...
)
Returns true if a story view is currently visible. Some methods like toNextStory, toPreviousCluster can't be used and throws an exception if the story view is not visible.
Displaying story and content position. Returns
0,0
if no story is currently displayed.Total count of stories.
Total content count in currently displaying story
Returns true if gestures are disabled, false otherwise.
Returns true if footer, header and indicators are visible, false otherwise.
Returns true if the story is paused, false otherwise.
Register a closure to be called when any story event happens. Events can be triggered by the user or automatically. Event types are:
- trayTap
- nextContent
- previousContent
- nextStory
- previousStory
- pause
- resume
- close
Listener Definition
typedef StoryEventCallback = FutureOr<void> Function(
/// Event type
StoryEvent event,
/// Current cluster and story index in cluster
StoryPosition position,
);
Removes a previously registered closure from the list of closures that are notified when an event happened. If the given listener is not registered, the call is ignored. Call this method when you don't need to listen events anymore.
Prevents gesture events. Prevents user from skipping between stories or clusters. Also user can't pause or close cluster by gestures. Note that Android back button still works for closing and automatic skipping still works on story duration end. If you want to prevent this, use combination of
disableGestures
and pause
.Gestures should enable by calling
enableGestures
after calling this method. Otherwise AdvStory
doesn't respond gestures anymore.Allows gesture events if disabled.
Hides header, footer and story indicator. When gestures are not disabled, user can show hidden widgets by tapping screen.
Shows header, footer and story indicator.
Pauses the current story, this stops the timer and the story will not skip to the next content. Pauses the video if current content is a
VideoContent
. When gestures are not disabled, user can resume by tapping screen.Resumes the current story, this starts the timer from last position and the story skips as usual. Resumes the video if current content is a
VideoContent
.Jumps to the content at the given position.
Skips to the next content if available. Otherwise skips to the next story or closes the story view.
Skips to the previous content if available. Otherwise skips to the previous story or does nothing.
Skips to the next story if available, otherwise closes the story view.
Skips to the previous story if available, otherwise does nothing.
Useful when you want to extend AdvStory media load strategy. By default, [AdvStory] loads previous and next contents media in the background.
Last modified 1yr ago