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

已关闭
#1,148 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

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

调研方向

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.

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

描述

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.

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

环境准备

从这里开始

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

mapbox/mapbox-maps-flutter 的其他 Issue

查看 mapbox/mapbox-maps-flutter 的全部 Issue

相似的 Issue

更多 Dart Issue

把新 issue 发到你的邮箱

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