【发布时间】:2022-07-09 03:28:32
【问题描述】:
我在使用 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,
),
],
),
],
)
],
),
),
),
],
);
}
the map should be placed over the mapbox text not off in the left corner
【问题讨论】:
标签: flutter android-studio mapbox mapbox-gl