mapbox_gl地图贴图从左上角开始



我遇到了mapbox_gl的问题,我加载其中一个地图的每个页面都出现在页面的左上角。这个不应该出现在中间吗?当你点击主页然后返回页面时,地图会在它应该属于的地方居中。

@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Center(
child: SizedBox(
width: 300.0,
height: 200.0,
child: MapboxMap(
accessToken: MapsDemo.ACCESS_TOKEN,
onMapCreated: _onMapCreated,
initialCameraPosition: const CameraPosition(
target: LatLng(-33.852, 151.211),
zoom: 11.0,
),
),
),
),
Expanded(
child: SingleChildScrollView(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Row(
children: <Widget>[
Column(
children: <Widget>[
TextButton(
child: const Text('add'),
onPressed: (_circleCount == 12) ? null : _add,
),
TextButton(
child: const Text('remove'),
onPressed: (_selectedCircle == null) ? null : _remove,
),
],
),
Column(
children: <Widget>[
TextButton(
child: const Text('change circle-opacity'),
onPressed: (_selectedCircle == null)
? null
: _changeCircleOpacity,
),
TextButton(
child: const Text('change circle-radius'),
onPressed: (_selectedCircle == null)
? null
: _changeCircleRadius,
),
TextButton(
child: const Text('change circle-color'),
onPressed: (_selectedCircle == null)
? null
: _changeCircleColor,
),
TextButton(
child: const Text('change circle-blur'),
onPressed: (_selectedCircle == null)
? null
: _changeCircleBlur,
),
TextButton(
child: const Text('change circle-stroke-width'),
onPressed: (_selectedCircle == null)
? null
: _changeCircleStrokeWidth,
),
TextButton(
child: const Text('change circle-stroke-color'),
onPressed: (_selectedCircle == null)
? null
: _changeCircleStrokeColor,
),
TextButton(
child: const Text('change circle-stroke-opacity'),
onPressed: (_selectedCircle == null)
? null
: _changeCircleStrokeOpacity,
),
TextButton(
child: const Text('change position'),
onPressed: (_selectedCircle == null)
? null
: _changePosition,
),
TextButton(
child: const Text('toggle draggable'),
onPressed: (_selectedCircle == null)
? null
: _changeDraggable,
),
TextButton(
child: const Text('get current LatLng'),
onPressed:
(_selectedCircle == null) ? null : _getLatLng,
),
],
),
],
)
],
),
),
),
],
);
}

地图应该放在地图框的上方,文本不能在左上角关闭

按home键后重新打开

目前我将mapbox_gl配置为下一个形式的pubspeech:
mapbox_gl: 0.14.0
mapbox_gl_web: 0.14.0
这对我来说是有效的。
我希望它对你或其他人有帮助,这是在这个答案的日期。

最新更新