mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: menu displayed at mouse location
This commit is contained in:
parent
c8d5769b11
commit
ab4a2e8b07
@ -76,13 +76,7 @@ class ViewDisclosureRegion extends StatelessWidget
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Listener(
|
||||
onPointerDown: (event) => {
|
||||
if (event.kind == PointerDeviceKind.mouse &&
|
||||
event.buttons == kSecondaryMouseButton)
|
||||
{
|
||||
show(context),
|
||||
}
|
||||
},
|
||||
onPointerDown: (event) => {_handleClick(event, context)},
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
@ -101,6 +95,17 @@ class ViewDisclosureRegion extends StatelessWidget
|
||||
(wrapper) => onSelected(dartz.some(wrapper.inner)),
|
||||
);
|
||||
};
|
||||
|
||||
void _handleClick(PointerDownEvent event, BuildContext context) {
|
||||
if (event.kind == PointerDeviceKind.mouse &&
|
||||
event.buttons == kSecondaryMouseButton) {
|
||||
RenderBox box = context.findRenderObject() as RenderBox;
|
||||
Offset position = box.localToGlobal(Offset.zero);
|
||||
double x = event.position.dx - position.dx - box.size.width;
|
||||
double y = event.position.dy - position.dy - box.size.height;
|
||||
show(context, anchorOffset: Offset(x, y));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ViewDisclosureActionWrapper extends ActionItem {
|
||||
|
@ -86,7 +86,6 @@ class ViewSectionItem extends StatelessWidget {
|
||||
}
|
||||
|
||||
return ViewDisclosureRegion(
|
||||
// context.read<ViewBloc>().add(const ViewEvent.setIsEditing(true)),
|
||||
onSelected: (action) {
|
||||
context.read<ViewBloc>().add(const ViewEvent.setIsEditing(false));
|
||||
_handleAction(context, action);
|
||||
|
Loading…
Reference in New Issue
Block a user