首页 > 解决方案 > 我有一个 ListView 和一个 DraggableScrollableSheet,它们可以在 Stack 小部件中重叠。是否有可能只有一个 GestureDetector 始终位于顶部?

问题描述

我有一个 ListView() 和一个 DraggableScrollableSheet(),它们可以在 Stack() 小部件中重叠。我可以说 DraggableScrollableSheet GestureDetector 总是在最前面吗?

现在 PageView 的 _pageController 位于 _scrollableSheetController 之上

Stack(
  alignment: Alignment.topCenter,
  children: [
    Column(
       children: [
          SizedBox(
            height: 20,
          ),  
          BreadCrumbIndicators(pageController: _pageController),
          PageView(...),
       ],
     ),
     NotificationListener<DraggableScrollableNotification>(
       onNotification: (notification) {
         print("bottom sheet postion : ${notification.extent}");
         setState(() {
           _bottomSheetPosition = notification.extent;
           });
           return true;
         },
         child: DraggableScrollableSheet(
             expand: true,
             initialChildSize: 0.3,
             minChildSize: 0.12,
             maxChildSize: 0.5),
       }
   ),
])

标签: flutterflutter-layout

解决方案


推荐阅读