mirror of
https://github.com/foss42/apidash.git
synced 2025-06-01 23:45:19 +08:00
can open the item menu on the right click for requests
This commit is contained in:
@ -41,3 +41,29 @@ class ItemCardMenu extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Open the item card menu where the right click has been released
|
||||
Future<void> showItemCardMenu(
|
||||
BuildContext context,
|
||||
TapUpDetails details,
|
||||
Function(ItemMenuOption)? onSelected,
|
||||
) async {
|
||||
showMenu(
|
||||
context: context,
|
||||
position: RelativeRect.fromLTRB(
|
||||
details.globalPosition.dx,
|
||||
details.globalPosition.dy,
|
||||
details.globalPosition.dx,
|
||||
details.globalPosition.dy,
|
||||
),
|
||||
items: ItemMenuOption.values
|
||||
.map<PopupMenuEntry<ItemMenuOption>>(
|
||||
(e) => PopupMenuItem<ItemMenuOption>(
|
||||
onTap: () => onSelected?.call(e),
|
||||
value: e,
|
||||
child: Text(e.label),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user