简体   繁体   English

Stack 底部 Widget 的 Flutter 手势检测

[英]Flutter Gesture Detection for Widget at the bottom of Stack

I am trying to develop an interface similar to Google Maps using Flutter.我正在尝试使用 Flutter 开发类似于 Google Maps 的界面。 My Flutter UI consists of a stack Widget, with the following child Widgets:我的 Flutter UI 由一个堆栈 Widget 组成,具有以下子 Widget:

  1. GoogleMaps (using the google maps plugin) GoogleMaps(使用谷歌地图插件)
  2. CustomScrollView with slivers (SliverPersistentHeader & SliverList)带有条子的 CustomScrollView (SliverPersistentHeader & SliverList)

I have made the SliverPersistentHeader be transparent so that the Google Maps shows below it.我已将 SliverPersistentHeader 设为透明,以便谷歌地图显示在其下方。 It looks fine, the only issue is GoogleMap could not get any gestures so it could not react to drag or tap gestures.看起来不错,唯一的问题是 GoogleMap 无法获得任何手势,因此无法对拖动或点击手势做出反应。

Any idea, how can I push the gestures down from the SliverHeader to GoogleMaps?任何想法,我怎样才能将手势从 SliverHeader 推送到 GoogleMaps?

Here is a graphical representation of how the UI looks like.这是 UI 外观的图形表示。

在此处输入图片说明

我认为一种解决方案是使用IgnorePointer小部件作为SliverHeader的父级,因为它会使所有子树在命中测试时不可见。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM