mapbox / mapbox/mapbox-maps-flutter

Puck layer not added the same way on iOS and Android

Offen
#577 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Dart
Sterne
380
Forks
204
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Start with LocationComponentSettings.updateSettings and the styleLayerExists call shown in the issue, then compare how the Flutter wrapper configures the location component on iOS and Android. Confirm whether omitting enabled should produce the same puck-layer behavior on both platforms; done means the behavior is consistent and the reported layer lookup no longer differs by platform.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
dart, flutter
Bereich
mobile-dev
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
40/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.