replace route instead of pushing

This commit is contained in:
shilangyu 2020-09-28 20:28:06 +02:00
parent 15ebfb6caa
commit bc736eb6aa
2 changed files with 9 additions and 1 deletions

View File

@ -169,7 +169,7 @@ class CreatePost extends HookWidget {
name: titleController.text,
communityId: selectedCommunity.value.id,
auth: token.raw);
goTo(context, (_) => FullPostPage.fromPostView(res));
goToReplace(context, (_) => FullPostPage.fromPostView(res));
return;
// ignore: avoid_catches_without_on_clauses
} catch (e) {

View File

@ -14,6 +14,14 @@ Future<dynamic> goTo(
builder: builder,
));
Future<dynamic> goToReplace(
BuildContext context,
Widget Function(BuildContext context) builder,
) =>
Navigator.of(context).pushReplacement(CupertinoPageRoute(
builder: builder,
));
void goToInstance(BuildContext context, String instanceUrl) =>
goTo(context, (context) => InstancePage(instanceUrl: instanceUrl));