Browse Source

加入鼠标事件监听

gavin.chen 2 năm trước cách đây
mục cha
commit
22dc58c127
1 tập tin đã thay đổi với 9 bổ sung4 xóa
  1. 9 4
      lib/popup_layer/popup_layer.dart

+ 9 - 4
lib/popup_layer/popup_layer.dart

@@ -40,7 +40,15 @@ class _PopupLayerState extends State<PopupLayer> {
   @override
   Widget build(BuildContext context) {
     return _isShowPopup
-        ? _buildMoreSchedulePopup(moreSchedulePopupKey)
+        ? Listener(
+            behavior: HitTestBehavior.translucent,
+            onPointerUp: (event) {
+              setState(() {
+                _isShowPopup = false;
+              });
+            },
+            child: _buildMoreSchedulePopup(moreSchedulePopupKey),
+          )
         : Container();
   }
 
@@ -66,9 +74,6 @@ class _PopupLayerState extends State<PopupLayer> {
             ],
           ),
           width: max(triggerSize.width, 220),
-          // height: 800,
-          // child: Text('Position: ${triggerOffset.dx} : ${triggerOffset.dy}'),
-
           child: MoreSchedulePopup(
             scheduleData: popupLayerController.currMoreScheduleData,
           ),