browser export

This commit is contained in:
yves committed 2026-11-07 19:49:09 +01:00
1 parent 1d974b42a1
commit 0966c6de17
13 files changed
+640 -207

No files matched your search

+37 -4
View File
@@ -1,7 +1,8 @@
# cesiumjs
A Flutter plugin that embeds a [CesiumJS](https://cesium.com/platform/cesiumjs/)
3D globe in Flutter apps on **Linux, Windows and Android**.
3D globe in Flutter apps on **Linux, Windows and Android**. It also
provides `WebBrowserView`, a plain web page shown by the same engines.
| Platform | Web engine | Integration | Status |
|---|---|---|---|
@@ -107,6 +108,35 @@ class _GlobePageState extends State<GlobePage> {
Controller calls are only valid after `onReady` (or `isReady == true`).
### `WebBrowserView`
A web page in the same native web view as the globe (WebKitGTK, WebView2,
Android WebView), with the same layering rules (see Limitations).
```dart
WebBrowserView(url: 'https://example.com', controller: browserController)
```
| Parameter | Description |
|---|---|
| `url` | Page to load; changing it navigates the view |
| `controller` | A `WebBrowserController` |
| `onError` | Page load failures and web process crashes |
| `visible` | Hides the web view without destroying it |
Links that would open a new window load in the view itself.
| `WebBrowserController` | Description |
|---|---|
| `loadUrl(url)` | Navigates to `url` |
| `reload()` | Reloads the page |
| `runJavaScript(script)` | Runs JS in the page, returns the result as a string |
| `openInspector()` | Dev tools (no-op on Android) |
| `isAttached` | Whether the controller drives a live view |
`nativeWebViewSupported` tells whether the current platform has native web
views.
### Messages from JavaScript
The page calls `CesiumChannel.postMessage(obj)`; objects are sent as JSON and
@@ -125,9 +155,9 @@ Your own scripts (via `runJavaScript`) can post custom types the same way.
- **Linux and Windows: Flutter widgets cannot be drawn over the globe**: the
web view is a native window above the Flutter surface. Put controls around
it, or set `visible: false` while a dialog, menu or drawer overlaps it. The
view is hidden automatically when another route is pushed on top. (Android
has no such restriction.)
it, or set `visible: false` while a drawer or overlay overlaps it. The
view is hidden automatically when another route is pushed on top, including
dialogs and popup menus. (Android has no such restriction.)
- Linux and Windows: the widget is positioned in window coordinates; don't
place it inside a scroll view that clips it.
- One Flutter view per app (the default) is supported.
@@ -170,6 +200,9 @@ lib/
src/cesium_controller.dart CesiumController, CesiumMessage, CesiumImagery
src/cesium_html.dart HTML page hosting Cesium (CDN version pinned here)
src/native_channel.dart `cesiumjs/webview` method channel wrapper
src/native_web_view.dart NativeWebViewHost: creates/places/hides one
native view (shared by both widgets)
src/web_browser.dart WebBrowserView, WebBrowserController
linux/
cesiumjs_plugin.cc WebKitGTK views in a GtkOverlay over the FlView
android/src/main/kotlin/…/CesiumjsPlugin.kt