[Android] onStyleLoadedListener is delayed until an inactive AutoTabsScaffold tab becomes active when using Hybrid Composition

Đã đóng
#1,148 2 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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
android, dart, flutter
Lĩnh vực
backend, mobile

Hướng nghiên cứu

Start by tracing MapWidget creation and onStyleLoadedListener through the Android Platform View integration, then compare Hybrid Composition with the VD hosting mode described in the workaround. Reproduce the inactive mounted tab case in the stated Flutter and plugin versions. Done means the style-loaded callback fires before the tab becomes active under Hybrid Composition, while the related issue’s distinct reproduction remains understood.

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

Mô tả

After migrating to mapbox_maps_flutter 3.x, the map style does not finish loading while the map is hosted in an inactive tab of an AutoTabsScaffold when using Hybrid Composition.

The map is created immediately because AutoTabsScaffold uses lazyLoad: false. The onMapCreated callback is invoked during the initial screen setup, but onStyleLoadedListener is not invoked until the user navigates to the map tab.

This delays the initialization of custom style layers.

Environment
  • Flutter: 3.47.8
  • mapbox_maps_flutter: 3.33.1
  • Platform: Android
  • Navigation: AutoTabsScaffold with lazyLoad: false
Expected behavior

The map should initialize its style and emit onStyleLoadedListener while its tab is inactive but mounted, allowing the application to prepare style and custom layers before the user navigates to the map tab.

Actual behavior

The map is created, but the style-loaded callback is delayed until the map tab becomes active.

Workaround

Setting androidHostingMode: AndroidPlatformViewHostingMode.VD while keeping textureView: true resolves the issue. This configuration enables the expected behavior.

MapWidget(
  textureView: true,
  androidHostingMode: AndroidPlatformViewHostingMode.VD,
  onMapCreated: onMapCreated,
  onStyleLoadedListener: onStyleLoaded,
)
Related issue

https://github.com/mapbox/mapbox-maps-flutter/issues/1147
The two issues appear to be related to the Android Platform View integration, but they have different reproduction steps and workarounds.

Ngôn ngữ chính
Dart
Star
379
Fork
205
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

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 mapbox/mapbox-maps-flutter

Tất cả issue của mapbox/mapbox-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.