Events
Stories events
To receive events from Story Reader you can implement IASCallbacks mixin and setup your listener:
class FeedWidget extends StatefulWidget {
const FeedWidget({super.key});
State<FeedWidget> createState() => _FeedWidgetState();
}
class _FeedWidgetState extends State<FeedWidget> with IASCallbacks {
Widget build(BuildContext context) {
return FeedStoriesWidget(
feed: '<your feed id>',
);
}
void onShowStory(StoryData? storyData) {}
void onCloseStory(SlideData? slideData) {}
// other callbacks
}
Event list
onShowStory- Called when the story reader is shown.
void onShowStory(StoryData? storyData) {}
onCloseStory- Called when the story reader is closed.
void onCloseStory(SlideData? slideData) {}
onFavoriteTap- Called when the favorite button is tapped.
void onFavoriteTap(SlideData? slideData, bool isFavorite) {}
onShareStory- Called when the share button is tapped.
void onShareStory(SlideData? slideData) {}
onLikeStoryTap- Called when the like button is tapped.
void onLikeStoryTap(SlideData? slideData, bool isLike) {}
onDislikeStoryTap- Called when the dislike button is tapped.
void onDislikeStoryTap(SlideData? slideData, bool isDislike) {}
onShowSlide- Called when the slide is shown.
void onShowSlide(SlideData? slideData) {}
onStoryWidgetEvent- Called when a widget event occurs in a story.
void onStoryWidgetEvent(SlideData? slideData, Map<String?, Object?>? widgetData) {}
Errors
To receive error from SDK, you need to add listener to the InAppStoryManager:
void addErrorCallback() {
InAppStoryManager.instance.setErrorCallback(IASErrorCallback(
sessionError: () {
print('Session error!');
},
noConnection: () {
print('No connection!');
},
));
}
Objects and Enums
Enums used in methods
enum StoryType {
common,
ugc,
iam,
banner;
}
enum SourceType {
single,
onboarding,
list,
favorite,
stack,
inAppMessage,
banners;
}
enum ClickAction {
button,
swipe,
game,
deeplink;
}
Method objects
class SlideData {
final StoryData? story;
final int index;
final String? payload;
}
class StoryData {
final int id;
final String? title;
final String? tags;
final String? feed;
final SourceType? sourceType;
final int slidesCount;
final StoryType? storyType;
final Map<String, String>? extraFields;
}