mirror of
https://github.com/Iconica-Development/flutter_timeline.git
synced 2025-05-19 10:33:44 +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,
|
options: widget.options,
|
||||||
onTapCreatePost: (post) async {
|
onTapCreatePost: (post) async {
|
||||||
await widget.options.onTapCreatePostInOverview?.call(post) ??
|
await widget.options.onTapCreatePostInOverview?.call(post) ??
|
||||||
await _pushAndRemoveUntil(_timelineScreenWidget());
|
_pushAndRemoveUntil(_timelineScreenWidget());
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
Future<void> _push(Widget screen) async {
|
Future<void> _push(Widget screen) async {
|
||||||
await Navigator.of(context)
|
await Navigator.of(context).push(
|
||||||
.push(MaterialPageRoute(builder: (context) => screen));
|
MaterialPageRoute(
|
||||||
}
|
builder: (context) => screen,
|
||||||
|
settings: const RouteSettings(arguments: "popForOverview"),
|
||||||
Future<void> _pushAndRemoveUntil(Widget screen) async {
|
),
|
||||||
await Navigator.of(context).pushAndRemoveUntil(
|
|
||||||
MaterialPageRoute(builder: (context) => screen),
|
|
||||||
(route) => route.isFirst,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _pushAndRemoveUntil(Widget screen) {
|
||||||
|
Navigator.of(context)
|
||||||
|
.popUntil((route) => route.settings.arguments != "popForOverview");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue