我在Google Maps插件上遇到了一个非常奇怪的问题,该问题由Flutter发布。从API响应添加标记后,地图平移手势会在窗口小部件周围移动,有时不允许其他UI元素接收触摸。插件版本为google_maps_flutter: ^0.2.0+5
,该版本在iOS上,小部件树为:
Stack(children: <Widget>[
new Container(
height: 300,
child: GoogleMap(
onMapCreated: _onMapCreated,
scrollGesturesEnabled: true,
zoomGesturesEnabled: true,
tiltGesturesEnabled: true,
initialCameraPosition: CameraPosition(
target: _center ?? LatLng(0, 0),
zoom: 15.0,
),
gestureRecognizers: Set()..add(Factory<PanGestureRecognizer>(() => PanGestureRecognizer())))),
new Positioned(
bottom: 16,
left: 16,
right: 16,
child: AnimatedContainer(
duration: moreInfoAnimationTime,
curve: Curves.easeIn,
transform: Matrix4.translationValues(_moreInfoOffset, 0, 0),
child: tappedOffer != null
? new Container(
height: OffersMapItemView.HEIGHT,
width: MediaQuery.of(context).size.width - 40,
child: new OffersMapItemView(
tappedOffer,
onTap: (OffersAndPromo offer) => this.goToOfferDetails(offer),
),
decoration: new BoxDecoration(
color: Colors.white,
borderRadius: new BorderRadius.circular(3.0),
boxShadow: [
new BoxShadow(
color: Colors.black45,
blurRadius: 10.0,
),
],
),
)
: new Text(''),
))
]);
定位的窗口小部件包含用于点击标记并显示自定义信息窗口的自定义动作。
颤抖的医生输出:
[✓] Flutter (Channel master, v1.2.3-pre.67, on Mac OS X 10.13.6 17G5019, locale
en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
[✓] Android Studio (version 3.2)
[✓] Connected device (2 available)