mirror of
https://github.com/Iconica-Development/flutter_timeline.git
synced 2025-05-19 10:33:44 +02:00
feat: add config setting to configure navigation after post creation
This commit is contained in:
parent
90e35e657e
commit
4569f25f4b
2 changed files with 13 additions and 1 deletions
|
@ -107,7 +107,14 @@ List<GoRoute> getTimelineStoryRoutes({
|
|||
onPostCreated: (post) async {
|
||||
await config.service.postService.createPost(post);
|
||||
if (context.mounted) {
|
||||
if (config.afterPostCreationGoHome) {
|
||||
context.go(TimelineUserStoryRoutes.timelineHome);
|
||||
} else {
|
||||
context.go(
|
||||
TimelineUserStoryRoutes.timelinePostOverview,
|
||||
extra: post,
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
onPostOverview: (post) async => context.push(
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue