Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

All existing annotations are re-sent and redrawn on every update (causes flicker/lag)

Đang mở Phù hợp với người mới
#92 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
84/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
dart, flutter
Lĩnh vực
mobile, performance

Hướng nghiên cứu

Đọc lib/src/annotation_updates.dart và kiểm tra cách các chú thích trước đó và hiện tại được so sánh khi tạo annotationsToChange. Xác nhận hành vi bằng cách đối chiếu với phần triển khai phép so sánh bằng nhau của chú thích, sau đó thêm hoặc cập nhật các bài kiểm thử tập trung vào chú thích không thay đổi. Hoàn thành khi chú thích không thay đổi bị loại khỏi các bản cập nhật, còn chú thích đã thay đổi vẫn được chuyển đến phía native.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Describe the bug
Every time AppleMap.annotations changes, every annotation that is still on the map is sent to the native side as "changed", even if nothing about it changed. On iOS each of them is then rebuilt and redrawn (with a 0.32 s animation), so with a few dozen annotations the map visibly flickers and stutters on every update. This is probably the cause of #57.

Cause

  1. lib/src/annotation_updates.dart builds annotationsToChange from the intersection of previous and current ids without comparing them:
    final Set<Annotation> _annotationsToChange = currentAnnotationIds
        .intersection(prevAnnotationIds)
        .map(idToCurrentAnnotation)
        .toSet();
    
    (google_maps_flutter filters these with .where(hasChanged).)
  2. On iOS, annotationsToChange creates a new FlutterAnnotation from the dictionary (decoding the icon bytes into a new UIImage) and compares it with !=. AnnotationIcon == compares image by reference, so it is always "different" and updateAnnotation runs for every annotation.

Fix (one line, Dart side). Annotation == already ignores onTap, so unchanged annotations compare equal if the app reuses the same BitmapDescriptor instance:

final Set<Annotation> _annotationsToChange = currentAnnotationIds
    .intersection(prevAnnotationIds)
    .where((AnnotationId id) => previousAnnotations[id] != currentAnnotations[id])
    .map(idToCurrentAnnotation)
    .toSet();

With this change, in our app (≈ 50 annotations re-grouped on every zoom/pan) the flicker on a real iPhone 16 Pro is gone.

Version: apple_maps_flutter 1.4.0, iOS 27, Flutter 3.32.1.

Happy to open a PR with this change.

Ngôn ngữ chính
Dart
Star
84
Fork
120
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của fluttercommunity/apple_maps_flutter

Tất cả issue của fluttercommunity/apple_maps_flutter

Issue tương tự

Thêm issue về Dart

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.