Visual Flicker Persists When Popping Route Between Two Screens with MapWidgets
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Domain
- mobile-dev
Research direction
Start by reproducing the issue with two screens containing a MapWidget, using Navigator.push and Navigator.pop as described, and compare the behavior with the linked video. Investigate the native PlatformView lifecycle during the pop transition, especially cleanup of the popped map while the destination map is revealed; done means returning to the first screen without flicker or a growing navigation stack.
Written by the indexing model from the issue text.
Description
Bug Description
When navigating between two screens that both contain a MapWidget, a noticeable visual flicker occurs. This happens specifically when using Navigator.pop() to return from the top screen to the one below it. The map from the screen being popped seems to briefly render over the destination screen before disappearing, creating a jarring user experience.
Steps to Reproduce
-
Create a ScreenA that contains a MapWidget.
-
Create a ScreenB that also contains a MapWidget.
-
From ScreenA, push ScreenB onto the navigation stack
(e.g., Navigator.push(context, MaterialPageRoute(builder: (_) => ScreenB()))).
- On ScreenB, have a button or back gesture that executes
Navigator.pop(context).
- Pop ScreenB to return to ScreenA.
Observe the visual flicker as ScreenA is revealed.
Expected Behavior
The navigation transition when popping the route should be smooth, without any visual artifacts or flickering from the map on the previous screen.
Current Behavior
A flicker occurs where the MapWidget from ScreenB is briefly visible during the transition back to ScreenA.
Additional Context & Workarounds Tried
I have attempted several workarounds, but none provide a complete and stable solution:
-
Using popAndPush or replaceAll: These navigation methods successfully avoid the visual flicker. However, they are not viable solutions as they create memory leaks by creating new screen instances instead of returning to the original one, causing the navigation stack to grow indefinitely.
-
This leads me to believe there is still an underlying race condition or an incomplete resource cleanup in the native PlatformView lifecycle when one map instance is destroyed while another is being revealed during a pop transition.
Video
https://github.com/user-attachments/assets/65896649-5d3a-492a-8633-e71ad72ea574
- Dominant language
- Dart
- Stars
- 379
- Forks
- 204
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mapbox/mapbox-maps-flutter
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
mapbox/mapbox-maps-flutter#1144 ·
-
iOS: the map cannot be captured or read by flutter, because it is a platform viewPossibly taken @Nixxx19 claimed this 38 days ago. Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
mapbox/mapbox-maps-flutter#1142 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
mapbox/mapbox-maps-flutter#1140 ·
-
Normalize ornament positioning relative to safe areas on iOS and AndroidMay be free again @maios claimed this 82 days ago, and no pull request is open. Open
mapbox/mapbox-maps-flutter#1137 · 1 comment · 1 reaction · 1 assignee ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
mapbox/mapbox-maps-flutter#1136 · 1 comment ·
All issues in mapbox/mapbox-maps-flutter
Similar issues
-
(fix) Wrong dateOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Solvro/mobile-topwr#1239 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
linagora/twake-on-matrix#3435 ·
Maintainers usually reply within 3 days
-
bug to check
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
右下角的图标问题Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
[Domain Activation] Show a user-friendly error when sending is blocked pending domain activationOpen
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
linagora/tmail-flutter#4953 · 1 comment ·
Maintainers usually reply within 1 day