我有一个 GridView 小部件,其中包含一些用 GestureDetector 包裹的 GridTiles,当我长按它时,尝试显示一个菜单以删除 GridTile ,,,一切都很好,除了我希望从我拥有的点开始显示该菜单点击的不是应用程序的顶部
showMenu(
context: context,
position: ..........,// Here i want the solution
items: [
PopupMenuItem(
child: FlatButton.icon(
onPressed: () {
_notesProv.deleteNote(id);
Navigator.of(context).pop();
},
icon: Icon(
Icons.delete,
color: Colors.black,
),
label: Text(
'delete note',
style: TextStyle(color: Colors.black),
),
),
),
],
color: Colors.green[100],
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
));
Run Code Online (Sandbox Code Playgroud) 我正在制作图片库,我需要用户能够长按图片以显示弹出菜单,该菜单可使他删除该图片。
到目前为止,我的代码:
return GestureDetector(
onLongPress: () {
showMenu(
items: <PopupMenuEntry>[
PopupMenuItem(
value: this._index,
child: Row(
children: <Widget>[
Icon(Icons.delete),
Text("Delete"),
],
),
)
],
context: context,
);
},
child: Image.memory(
this._asset.thumbData.buffer.asUint8List(),
fit: BoxFit.cover,
gaplessPlayback: true,
),
);
Run Code Online (Sandbox Code Playgroud)
产生:

但是,当调用longPress函数时,我无法找出如何完全删除图像的小部件。怎么做?