Reputation: 7150
I am trying to positioning the context menu in flutter web using showMenu
and GestureDetector
. I found the way how to do this but the only thing I didn't catch is how to understand the RelativeRect
as position? What is actually RelativeRect
?
My solution is simple:
GestureDetector(
onSecondaryTap: (details) {
final offset = details.globalPosition;
showMenu(
...
position: RelativeRect.fromLTRB(offset.dx,offset.dy,offset.dx,offset.dy),
...
);
}
)
But I think it is the case-by-case solution. I saw the code for PopupMenuButton
and I didn't understand how the starting position is calculated?
Could somebody please to explain?
Upvotes: 3
Views: 321