diff --git a/packages/flutter_timeline/lib/src/flutter_timeline_gorouter_userstory.dart b/packages/flutter_timeline/lib/src/flutter_timeline_gorouter_userstory.dart index e1f6cbf..91f49f9 100644 --- a/packages/flutter_timeline/lib/src/flutter_timeline_gorouter_userstory.dart +++ b/packages/flutter_timeline/lib/src/flutter_timeline_gorouter_userstory.dart @@ -107,7 +107,14 @@ List getTimelineStoryRoutes({ onPostCreated: (post) async { await config.service.postService.createPost(post); if (context.mounted) { - context.go(TimelineUserStoryRoutes.timelineHome); + if (config.afterPostCreationGoHome) { + context.go(TimelineUserStoryRoutes.timelineHome); + } else { + context.go( + TimelineUserStoryRoutes.timelinePostOverview, + extra: post, + ); + } } }, onPostOverview: (post) async => context.push( diff --git a/packages/flutter_timeline/lib/src/models/timeline_configuration.dart b/packages/flutter_timeline/lib/src/models/timeline_configuration.dart index fc14ee6..669afe5 100644 --- a/packages/flutter_timeline/lib/src/models/timeline_configuration.dart +++ b/packages/flutter_timeline/lib/src/models/timeline_configuration.dart @@ -55,6 +55,7 @@ class TimelineUserStoryConfiguration { this.onPostDelete, this.filterEnabled = false, this.postWidgetBuilder, + this.afterPostCreationGoHome = false, this.enablePostOverviewScreen = false, }); @@ -88,4 +89,8 @@ class TimelineUserStoryConfiguration { /// Boolean to enable timeline post overview screen before submitting final bool enablePostOverviewScreen; + + /// Boolean to enable redirect to home after post creation. + /// If false, it will redirect to created post screen + final bool afterPostCreationGoHome; }