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);
}
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(),
],
),