From cba4f19b179f1f7349bf291dfdf991f69ac52278 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 24 Mar 2024 12:32:24 +0800 Subject: [PATCH] :sparkles: Reload after post --- lib/screens/explore.dart | 4 +++- lib/screens/publish/comment_editor.dart | 5 +++-- lib/screens/publish/moment_editor.dart | 8 +++++--- lib/widgets/posts/comments.dart | 6 +++++- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/screens/explore.dart b/lib/screens/explore.dart index 5be6ca9..3504e44 100644 --- a/lib/screens/explore.dart +++ b/lib/screens/explore.dart @@ -84,7 +84,9 @@ class _ExploreScreenState extends State { return FloatingActionButton( child: const Icon(Icons.edit), onPressed: () { - router.push("/post/moments"); + router.push("/post/moments").then((value) { + if (value == true) paginationController.refresh(); + }); }, ); } else { diff --git a/lib/screens/publish/comment_editor.dart b/lib/screens/publish/comment_editor.dart index 1641784..6f44abc 100644 --- a/lib/screens/publish/comment_editor.dart +++ b/lib/screens/publish/comment_editor.dart @@ -51,7 +51,7 @@ class _CommentEditorScreenState extends State { ); } else { if (router.canPop()) { - router.pop(); + router.pop(true); } } setState(() => isSubmitting = false); @@ -105,7 +105,8 @@ class _CommentEditorScreenState extends State { keyboardType: TextInputType.multiline, controller: contentController, decoration: const InputDecoration.collapsed( - hintText: "What do you want to say?"), + hintText: "What do you want to say?", + ), ), ), ), diff --git a/lib/screens/publish/moment_editor.dart b/lib/screens/publish/moment_editor.dart index 9e6db30..61fb7a9 100644 --- a/lib/screens/publish/moment_editor.dart +++ b/lib/screens/publish/moment_editor.dart @@ -41,7 +41,7 @@ class _MomentEditorScreenState extends State { ); } else { if (router.canPop()) { - router.pop(); + router.pop(true); } } setState(() => isSubmitting = false); @@ -95,7 +95,8 @@ class _MomentEditorScreenState extends State { keyboardType: TextInputType.multiline, controller: contentController, decoration: const InputDecoration.collapsed( - hintText: "What\'s happened?!"), + hintText: "What's happened?!", + ), ), ), ), @@ -108,7 +109,8 @@ class _MomentEditorScreenState extends State { snapshot.data?.getBool( "editor.hide_website_recommendation") == null) { - snapshot.data?.remove("editor.hide_website_recommendation"); + snapshot.data + ?.remove("editor.hide_website_recommendation"); return MaterialBanner( padding: const EdgeInsets.all(20), content: const Text( diff --git a/lib/widgets/posts/comments.dart b/lib/widgets/posts/comments.dart index 7c18f21..5af1f17 100644 --- a/lib/widgets/posts/comments.dart +++ b/lib/widgets/posts/comments.dart @@ -92,7 +92,11 @@ class _CommentListWidgetState extends State { icon: const Icon(Icons.edit), label: const Text("LEAVE COMMENT"), onPressed: () { - router.push("/post/comments", extra: widget.parent); + router + .push("/post/comments", extra: widget.parent) + .then((value) { + if (value == true) paginationController.refresh(); + }); }, ); } else {