From 727b28de2601fa613675c1831cfcd16593092004 Mon Sep 17 00:00:00 2001 From: Filip Krawczyk Date: Tue, 19 Oct 2021 19:39:43 +0200 Subject: [PATCH] rework variables to reduce unwrapping --- lib/pages/full_post/full_post.dart | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/pages/full_post/full_post.dart b/lib/pages/full_post/full_post.dart index 34ae6b0..4573cec 100644 --- a/lib/pages/full_post/full_post.dart +++ b/lib/pages/full_post/full_post.dart @@ -118,9 +118,9 @@ class _FullPostPage extends HookWidget { ?.jwt); } - final post = store.postView; + final postStore = store.postStore; - if (post == null) { + if (postStore == null) { return Scaffold( appBar: AppBar(), body: Center( @@ -132,6 +132,8 @@ class _FullPostPage extends HookWidget { ); } + final post = postStore.postView; + // VARIABLES sharePost() => share(post.post.apId, context: context); @@ -160,14 +162,14 @@ class _FullPostPage extends HookWidget { actions: [ IconButton(icon: Icon(shareIcon), onPressed: sharePost), Provider.value( - value: store.postStore!, + value: postStore, child: const SavePostButton(), ), IconButton( icon: Icon(moreIcon), onPressed: () => PostMoreMenuButton.show( context: context, - postStore: store.postStore!, + postStore: postStore, fullPostStore: store, ), ), @@ -186,7 +188,7 @@ class _FullPostPage extends HookWidget { physics: const AlwaysScrollableScrollPhysics(), children: [ const SizedBox(height: 15), - PostTile.fromPostStore(store.postStore!), + PostTile.fromPostStore(postStore), const CommentSection(), ], ),