mapbox / mapbox/mapbox-maps-flutter

Puck layer not added the same way on iOS and Android

未关闭
#577 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Dart
星标
380
派生
204
PR 合并指标
30 天内没有已合并 PR

描述

When you set the puck settings as:

    mapboxMap?.location.updateSettings(
      LocationComponentSettings(
        pulsingEnabled: false,
        showAccuracyRing: true,
        puckBearing: PuckBearing.COURSE,
        puckBearingEnabled: true,
      ),
    );

You can access the puck layer with:

if (Platform.isAndroid) {
      puckLayerId = 'mapbox-location-indicator-layer';
    } else {
      puckLayerId = 'puck';
    }

    try {
      bool? puckLayerExists =
          await mapboxMap?.style.styleLayerExists(puckLayerId);

However when you use the same code for Android, it fails. The error tells you the puck layer does not exist.

In order to fix this you need to add enabled: true

    mapboxMap?.location.updateSettings(
      LocationComponentSettings(
        enabled: true, // Needed for Android
        pulsingEnabled: false,
        showAccuracyRing: true,
        puckBearing: PuckBearing.COURSE,
        puckBearingEnabled: true,
      ),
    );

I think this behavior should be consistent across iOS and Android. So I guess the bug is that when enabled: true is not provided on iOS it still adds the puck layer.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 LocationComponentSettings.updateSettings 和 issue 中显示的 styleLayerExists 调用开始,然后比较 Flutter wrapper 在 iOS 和 Android 上如何配置 location component。确认省略 enabled 是否应当在两个平台上产生相同的 puck layer 行为;当行为一致且报告的 layer lookup 不再因平台而异时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
dart, flutter
领域
mobile-dev
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
40/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。