mapbox / mapbox/mapbox-maps-flutter

PointAnnotation disappear on update [Example app]

Open
#339 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Dart
Stars
380
Forks
204
PR merge metrics
No merged PRs in 30d

Description

In example app point_annotation page.

When I try and update PointAnnotation as per below code in example app then PointAnnotation disappears.

```
class AnnotationClickListener extends OnPointAnnotationClickListener {
AnnotationClickListener(this.pointAnnotationManager);

final PointAnnotationManager pointAnnotationManager;
@override
void onPointAnnotationClick(PointAnnotation annotation) async {
print("onAnnotationClick, id: ${annotation.id}");
if (annotation.textField == null) {
annotation.textField = "Test data";
annotation.textOffset = [0.0, -2.0];
annotation.textColor = Colors.red.value;
annotation.iconSize = 1.3;
annotation.iconOffset = [0.0, -5.0];
} else {
annotation.textField = null;
}
await pointAnnotationManager.update(annotation);
}
}
```

What i am trying to do here is if no text is being displayed then show text, if text is displayed then hide text.

Text show and hide works fine, but it also hide marker icon.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the point_annotation page in the example app and reproduce the issue using the shown AnnotationClickListener and PointAnnotationManager.update call. Check why updating text and offsets also removes the marker icon, then verify that toggling the text leaves the icon visible in both states.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.