Make showContextMenu more generic
This commit is contained in:
parent
b9bc345b56
commit
40461aabbf
2 changed files with 20 additions and 17 deletions
|
|
@ -3,7 +3,7 @@ import "package:flutter/material.dart";
|
|||
extension ShowContextMenu on BuildContext {
|
||||
void showContextMenu({
|
||||
required Offset globalPosition,
|
||||
required VoidCallback onTap,
|
||||
required List<PopupMenuEntry> children,
|
||||
}) {
|
||||
final overlay = Overlay.of(this).context.findRenderObject() as RenderBox;
|
||||
|
||||
|
|
@ -16,20 +16,7 @@ extension ShowContextMenu on BuildContext {
|
|||
overlay.size.height - globalPosition.dy,
|
||||
),
|
||||
color: Theme.of(this).colorScheme.surfaceContainerHighest,
|
||||
items: [
|
||||
PopupMenuItem(
|
||||
onTap: onTap,
|
||||
child: ListTile(leading: Icon(Icons.reply), title: Text("Reply")),
|
||||
),
|
||||
PopupMenuItem(
|
||||
onTap: onTap,
|
||||
child: ListTile(leading: Icon(Icons.edit), title: Text("Edit")),
|
||||
),
|
||||
PopupMenuItem(
|
||||
onTap: onTap,
|
||||
child: ListTile(leading: Icon(Icons.delete), title: Text("Delete")),
|
||||
),
|
||||
],
|
||||
items: children,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue