mirror of
https://github.com/Iconica-Development/flutter_timeline.git
synced 2025-05-19 02:23:46 +02:00
fix: pop properly to overview screen after creating post
This commit is contained in:
parent
f0c1c265b3
commit
7262729a04
1 changed files with 11 additions and 9 deletions
|
@ -97,19 +97,21 @@ class _FlutterTimelineNavigatorUserstoryState
|
|||
options: widget.options,
|
||||
onTapCreatePost: (post) async {
|
||||
await widget.options.onTapCreatePostInOverview?.call(post) ??
|
||||
await _pushAndRemoveUntil(_timelineScreenWidget());
|
||||
_pushAndRemoveUntil(_timelineScreenWidget());
|
||||
},
|
||||
);
|
||||
|
||||
Future<void> _push(Widget screen) async {
|
||||
await Navigator.of(context)
|
||||
.push(MaterialPageRoute(builder: (context) => screen));
|
||||
}
|
||||
|
||||
Future<void> _pushAndRemoveUntil(Widget screen) async {
|
||||
await Navigator.of(context).pushAndRemoveUntil(
|
||||
MaterialPageRoute(builder: (context) => screen),
|
||||
(route) => route.isFirst,
|
||||
await Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => screen,
|
||||
settings: const RouteSettings(arguments: "popForOverview"),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _pushAndRemoveUntil(Widget screen) {
|
||||
Navigator.of(context)
|
||||
.popUntil((route) => route.settings.arguments != "popForOverview");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue