Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Commit

Permalink
fix: menu unable to be shown on repeated posts
Browse files Browse the repository at this point in the history
  • Loading branch information
Craftplacer committed Sep 25, 2023
1 parent eb34913 commit 73bfb0e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/kaiteki/lib/ui/shared/posts/layouts/expanded.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ class ExpandedPostLayout extends ConsumerWidget {
),
ExpandedPostLayout(
repeatOf,
onOpen: onOpen,
callbacks: callbacks,
onReact: onReact,
onOpen: onOpen,
onTap: onTap,
menuFocusNode: menuFocusNode,
),
],
);
Expand Down
3 changes: 3 additions & 0 deletions src/kaiteki/lib/ui/shared/posts/layouts/normal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ class NormalPostLayout extends ConsumerWidget {
repeatOf,
callbacks: callbacks,
onReact: onReact,
onOpen: onOpen,
onTap: onTap,
menuFocusNode: menuFocusNode,
),
],
);
Expand Down
4 changes: 3 additions & 1 deletion src/kaiteki/lib/ui/shared/posts/layouts/wide.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ class WidePostLayout extends ConsumerWidget {
),
WidePostLayout(
repeatOf,
onOpen: onOpen,
callbacks: callbacks,
onReact: onReact,
onOpen: onOpen,
onTap: onTap,
menuFocusNode: menuFocusNode,
),
],
);
Expand Down
8 changes: 5 additions & 3 deletions src/kaiteki/lib/ui/shared/posts/post_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,12 @@ class _PostWidgetState extends ConsumerState<PostWidget> {
final anchor =
_menuAnchorKey.currentContext!.findRenderObject() as RenderBox;

final button =
_menuButtonFocusNode.context!.findRenderObject() as RenderBox;
final buttonContext = _menuButtonFocusNode.context;

final offset = button.localToGlobal(Offset.zero, ancestor: anchor);
assert(buttonContext != null);

final buttonRenderBox = buttonContext!.findRenderObject() as RenderBox;
final offset = buttonRenderBox.localToGlobal(Offset.zero, ancestor: anchor);

_menuController.open(position: offset);
}
Expand Down

0 comments on commit 73bfb0e

Please sign in to comment.