rework variables to reduce unwrapping

This commit is contained in:
Filip Krawczyk 2021-10-19 19:39:43 +02:00
parent b58f91bc84
commit 727b28de26
1 changed files with 7 additions and 5 deletions

View File

@ -118,9 +118,9 @@ class _FullPostPage extends HookWidget {
?.jwt); ?.jwt);
} }
final post = store.postView; final postStore = store.postStore;
if (post == null) { if (postStore == null) {
return Scaffold( return Scaffold(
appBar: AppBar(), appBar: AppBar(),
body: Center( body: Center(
@ -132,6 +132,8 @@ class _FullPostPage extends HookWidget {
); );
} }
final post = postStore.postView;
// VARIABLES // VARIABLES
sharePost() => share(post.post.apId, context: context); sharePost() => share(post.post.apId, context: context);
@ -160,14 +162,14 @@ class _FullPostPage extends HookWidget {
actions: [ actions: [
IconButton(icon: Icon(shareIcon), onPressed: sharePost), IconButton(icon: Icon(shareIcon), onPressed: sharePost),
Provider.value( Provider.value(
value: store.postStore!, value: postStore,
child: const SavePostButton(), child: const SavePostButton(),
), ),
IconButton( IconButton(
icon: Icon(moreIcon), icon: Icon(moreIcon),
onPressed: () => PostMoreMenuButton.show( onPressed: () => PostMoreMenuButton.show(
context: context, context: context,
postStore: store.postStore!, postStore: postStore,
fullPostStore: store, fullPostStore: store,
), ),
), ),
@ -186,7 +188,7 @@ class _FullPostPage extends HookWidget {
physics: const AlwaysScrollableScrollPhysics(), physics: const AlwaysScrollableScrollPhysics(),
children: [ children: [
const SizedBox(height: 15), const SizedBox(height: 15),
PostTile.fromPostStore(store.postStore!), PostTile.fromPostStore(postStore),
const CommentSection(), const CommentSection(),
], ],
), ),