GestureDetector 中的 ScrollView:调度触摸事件

最白目*_*最白目 5 dart flutter

我有一个GestureDetector负责上下拖动容器以改变高度。容器的内容可能太长,所以必须滚动内容。

我不知道如何将触摸事件分派到正确的组件,我尝试使用 aIgnorePointer并更改ignoring属性。

class _SlideSheetState extends State<SlideSheet>

  bool _ignoreScrolling = true;

  GestureDetector(
    onVerticalDragUpdate: (DragUpdateDetails details) {
      if(isDraggedUp) {
        setState(() {
          _ignoreScrolling = false
        });          
      }
      // update height of container, omitted for simplicity
    },
    child: NotificationListener(
      onNotification: (ScrollNotification notification) {
            if(notification is OverscrollNotification) {

              if(notification.overscroll < 0) {
                  // the scrollview is scrolled to top
                  setState(() {
                     _ignoreScrolling = true;
                  });

              }

            }
       },
       child: IgnorePointer(
         ignoring: _ignoreScrolling,
         child: SingleChildScrollView(
           physics: ClampingScrollPhysics(),
           child: Container(
             // ...
           )
         )
       )
  )
Run Code Online (Sandbox Code Playgroud)

有人知道在 Widget 树上向上或向下发送触摸事件的好方法吗?因为在我的解决方案中,显然,您总是必须进行一次触摸事件才能将“侦听器”从 更改GestureDetectorSingleChildScrollView,这至少可以说对用户来说很烦人。