【发布时间】:2020-07-03 10:31:22
【问题描述】:
我正在使用 google_maps_flutter。我的小部件树是 Scaffold -> SingleChildScrollView -> Stack,然后是谷歌地图。我无法使用手势放大和缩小。
SingleChildScrollView( Stack(
children: <Widget>[
Container(
height: MediaQuery.of(context).size.height - 10.0,
width: MediaQuery.of(context).size.width * 1,
child: _mapView
? GoogleMap(
initialCameraPosition: CameraPosition(
target: _outletData[0].locationCoords, zoom: 12.0),
markers: Set.from(allMarkers),
onMapCreated: mapCreated,
zoomControlsEnabled: false,
zoomGesturesEnabled: true,
scrollGesturesEnabled: true,
compassEnabled: true,
rotateGesturesEnabled: true,
mapToolbarEnabled: true,
tiltGesturesEnabled: true,
)
: Container(),
),
我也尝试了下面的代码,但仍然无法使用两指触摸放大缩小
Stack(
children: <Widget>[
Container(
height: MediaQuery.of(context).size.height - 10.0,
width: MediaQuery.of(context).size.width * 1,
child: _mapView
? GoogleMap(
initialCameraPosition: CameraPosition(
target: _outletData[0].locationCoords, zoom: 12.0),
markers: Set.from(allMarkers),
onMapCreated: mapCreated,
zoomControlsEnabled: false,
zoomGesturesEnabled: true,
scrollGesturesEnabled: true,
compassEnabled: true,
rotateGesturesEnabled: true,
mapToolbarEnabled: true,
tiltGesturesEnabled: true,
gestureRecognizers: Set()
..add(Factory<PanGestureRecognizer>(
() => PanGestureRecognizer()))
..add(Factory<ScaleGestureRecognizer>(
() => ScaleGestureRecognizer()))
..add(Factory<TapGestureRecognizer>(
() => TapGestureRecognizer()))
..add(
Factory<VerticalDragGestureRecognizer>(
() => VerticalDragGestureRecognizer()),
),
)
: Container(),
),
【问题讨论】:
标签: google-maps flutter