iOS: the map cannot be captured or read by flutter, because it is a platform view
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 25/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- dart, ios
- Bereich
- mobile, mobile-dev
Rechercherichtung
Beginne mit dem MapWidget-iOS-Platform-View-Pfad und reproduziere die im Issue beschriebene RepaintBoundary.toImage-Aufnahme. Prüfe den vorgeschlagenen Offscreen-Texture-Pfad aus dem Fork und kläre anschließend, ob er in ein separates Widget oder als Option von MapWidget gehört. Als abgeschlossen gilt die Arbeit, wenn die Kartenpixel in Aufnahmen erscheinen und die bestehende MapboxMap API, Interaktionen, das Logo und die Attribution weiterhin funktionieren.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
what happens
on ios the map is a UiKitView. uikit composites it, not flutter, so the map is not in flutter's scene. anything that needs to read the map back therefore reads nothing:
RepaintBoundary.toImageandtoImageSyncreturn a hole where the map is. screenshot a page with a map on it and you get everything except the map.- a custom
ImageFilter.shaderused as a backdrop samples an empty texture, so a shader driven surface over the map renders as whatever it does with no input. in our case that was solid black. - anything else that composites against what is beneath it has nothing beneath it.
plain BackdropFilter is fine, the engine special cases it, so this is not "you cannot blur the map". it is narrower and harder: you cannot get the map's pixels into flutter.
android does not have this problem. MapWidget there can render into a TextureView, which puts the map inside the flutter scene where everything can see it. there is no equivalent on ios.
why it is not just a flag we forgot to port
android's textureView switches the render surface inside a platform view that already composites in the flutter scene. on ios platform views are always uikit composited (flutter/flutter#43902), so the fix is not a flag, it is giving the map a real texture path.
how to reproduce
- put a
MapWidgetin a page - wrap the page in a
RepaintBoundary - call
toImageon it and draw the result
the map area comes back blank. everything drawn by flutter comes back fine.
the panel on the right is the capture. the map behind it is rendering perfectly, and the capture of it is white.
what we did about it
we have this working in a fork: the map is created without a platform view, hosted offscreen, and its frames are handed to FlutterTextureRegistry, so the widget tree gets a Texture and nothing else. annotations, the full MapboxMap api, pan, pinch, rotate, pitch, resize and the logo and attribution all work, and captures contain the map.
happy to open the pr. it is about 700 lines, three new files plus 20 lines touched in existing ones, and nothing changes for anyone using MapWidget.
before asking you to review that, two questions:
- is an ios texture path something you would take in principle, or is uikit composition a deliberate constraint?
- if you would take it, do you want it as a separate widget or as an option on
MapWidget?
- Vorherrschende Sprache
- Dart
- Sterne
- 382
- Forks
- 205
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus mapbox/mapbox-maps-flutter
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 30/100
mapbox/mapbox-maps-flutter#1152 ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
mapbox/mapbox-maps-flutter#1150 · 1 Kommentar ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
mapbox/mapbox-maps-flutter#1144 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 58/100
mapbox/mapbox-maps-flutter#1140 ·
-
Normalize ornament positioning relative to safe areas on iOS and AndroidEvtl. wieder frei @maios hat das vor 136 Tagen übernommen, und es ist kein Pull Request offen. Offen
mapbox/mapbox-maps-flutter#1137 · 1 Kommentar · 1 Reaktion · 1 zugewiesene Person ·
Alle Issues in mapbox/mapbox-maps-flutter
Ähnliche Issues
-
消费码加载时间太长Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
HeZeBang/TechPie-flutter#294 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
ccch1mneyyy/dsh-Go#2192 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
hiddify/hiddify-app#2724 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Submit: CasamaOffen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100