Flutter 长按控件在对应位置弹出 Menu 菜单 (含震动反馈)

2021-06-12T15:13:00
GestureDetector(
  child: ,
  onLongPressStart: (details) {
    Feedback.forLongPress(this.context); // Add Feedback
    showMenu(
      context: context,
      position: RelativeRect.fromLTRB(
        details.globalPosition.dx,
        details.globalPosition.dy,
        details.globalPosition.dx,
        details.globalPosition.dy,
      ),
      items: <PopupMenuEntry>[
        PopupMenuItem(child: Text("删除")), // Menu Item
      ],
    );
  },
);
当前页面是本站的「Baidu MIP」版。发表评论请点击:完整版 »