From ac34ef4d710f57a2d545260e4a32a74970a5c05c Mon Sep 17 00:00:00 2001 From: Yoann Lafore Date: Mon, 8 Apr 2024 19:47:14 +0200 Subject: [PATCH] feat(overview): add a refresh button for when there are no posts to display --- lib/views/pages/home/posts/home_feed.dart | 35 ++++++++++++++++------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/lib/views/pages/home/posts/home_feed.dart b/lib/views/pages/home/posts/home_feed.dart index 08851a5e..08c77495 100644 --- a/lib/views/pages/home/posts/home_feed.dart +++ b/lib/views/pages/home/posts/home_feed.dart @@ -11,6 +11,7 @@ import "package:proxima/views/sort_option_widgets/feed_sort_option/feed_sort_opt class HomeFeed extends HookConsumerWidget { static const feedSortOptionKey = Key("feedSortOption"); static const emptyHomeFeedKey = Key("emptyHomeFeed"); + static const refreshButtonKey = Key("refreshButton"); const HomeFeed({super.key}); @override @@ -19,20 +20,32 @@ class HomeFeed extends HookConsumerWidget { final emptyHelper = Center( key: emptyHomeFeedKey, - child: Row( + child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - const Text("No post to display, "), - InkWell( - onTap: () => { - //TODO: Add navigation to create post page - }, - child: const Text( - "create one", - style: TextStyle( - color: Colors.blue, + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Text("No post to display, "), + InkWell( + onTap: () => { + //TODO: Add navigation to create post page + }, + child: const Text( + "create one", + style: TextStyle( + color: Colors.blue, + ), + ), ), - ), + ], + ), + ElevatedButton( + key: refreshButtonKey, + onPressed: () async { + return ref.refresh(postOverviewProvider); + }, + child: const Text("Refresh"), ), ], ),