【问题标题】:mapbox_gl map tile starts in top left cornermapbox_gl 地图图块从左上角开始
【发布时间】: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

After pressing home and reopening

【问题讨论】:

    标签: flutter android-studio mapbox mapbox-gl


    【解决方案1】:

    很抱歉迟到了,我有同样的问题,我做了很多研究,但没有找到任何东西,目前我在下一个表单的 pubspech 中配置 mapbox_gl: mapbox_gl:0.14.0 mapbox_gl_web:0.14.0 这对我有用。 我希望它在这个答案的日期为你或其他人服务。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-29
      • 1970-01-01
      • 1970-01-01
      • 2017-02-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多