Example App and Screen-by-Screen Walkthrough
The example app is the fastest way to see the plugin’s main surfaces in one runnable Flutter project. It is intentionally organized as a screen catalog: each screen isolates one capability area such as inline WebView controls, browser modes, headless execution, passkeys, or startup-race stress testing. This page gives beginners a guided tour of what exists, where to click, and what each screen demonstrates.
Sources: pubspec.yaml main.dart
Run the Example and Understand the Shell
Section titled “Run the Example and Understand the Shell”Start from zikzak_inappwebview/example. The app boots a MaterialApp, creates platform-aware setup (Windows WebView2 environment and Android debug inspection), and then exposes a drawer-driven navigation shell whose menu items change by platform. On macOS, you can also launch directly into a named route with START_ROUTE, which is useful when you are iterating on one screen only.
flowchart TD A[Flutter main] --> B[Platform setup] B --> C[MaterialApp routes] C --> D[Drawer menu] D --> E[InAppWebView] D --> F[InAppBrowser / ChromeSafariBrowser] D --> G[HeadlessInAppWebView] D --> H[Special demos]| Platform branch | Typical menu items | Why it differs |
|---|---|---|
| Android / iOS default | Inline, Edge-to-edge, InAppBrowser, ChromeSafariBrowser, Headless, First-Load Race | Broadest cross-platform demo set |
| macOS | Inline, InAppBrowser, Headless, Passkey (plus route override) | Adds passkey-focused flow |
| Windows / Linux | Inline, InAppBrowser, Headless, Network Capture item | Desktop-focused subset |
| Web | Inline, Headless (plus Network Capture item) | Web-specific subset |
Sources: main.dart main.dart main.dart
Screen 1: InAppWebView (Main Workhorse)
Section titled “Screen 1: InAppWebView (Main Workhorse)”This is the default screen and the best first stop. You get a visible WebView, URL/search field, progress bar, navigation controls, settings dialog, screenshot/PDF actions, media capture test, cookie deletion, find-in-page, fullscreen, and JavaScript evaluation. The screen is intentionally interactive so you can learn by tapping and observing callback behavior.
| UI area | What to try | Concept demonstrated |
|---|---|---|
| Top app bar icons | Screenshot, PDF, delete cookies, find, settings | Controller actions and managers |
| URL field | Enter URL or search text | loadUrl behavior with scheme fallback |
| WebView body | Browse normally | Navigation callbacks and progress updates |
| Bottom controls | Back/forward/reload/fullscreen/run JS | Controller command surface |
Sources: in_app_webiew_example.screen.dart in_app_webiew_example.screen.dart in_app_webiew_example.screen.dart in_app_webiew_example.screen.dart
Screen 2: Edge-to-Edge WebView (Android)
Section titled “Screen 2: Edge-to-Edge WebView (Android)”Use this screen to understand Android inset behavior in a compact demo. A single switch toggles insetsForWebContentToIgnore so web content can render behind system bars, display cutout, and IME. The key learning point is that this is a WebView-side setting; your host Android activity must also be edge-to-edge for the full effect.
Sources: in_app_webview_edge_to_edge.screen.dart in_app_webview_edge_to_edge.screen.dart in_app_webview_edge_to_edge.screen.dart
Screen 3: InAppBrowser
Section titled “Screen 3: InAppBrowser”This screen demonstrates the in-app browser mode rather than an inline widget. It subclasses InAppBrowser, overrides lifecycle and permission callbacks, and exposes two actions: open in-app browser or open system browser. Beginners should watch callback logs (onBrowserCreated, onLoadStop, onExit) to connect lifecycle events to user behavior.
Sources: in_app_browser_example.screen.dart in_app_browser_example.screen.dart in_app_browser_example.screen.dart
Screen 4: ChromeSafariBrowser
Section titled “Screen 4: ChromeSafariBrowser”This screen shows the platform-native browser handoff pattern (ChromeSafariBrowser) with custom menu/action button setup and open/close lifecycle callbacks. It is a good place to learn how custom chrome actions are configured before calling open().
Sources: chrome_safari_browser_example.screen.dart chrome_safari_browser_example.screen.dart chrome_safari_browser_example.screen.dart
Screen 5: HeadlessInAppWebView
Section titled “Screen 5: HeadlessInAppWebView”This screen makes headless execution tangible: run, send console.log, dispose, and fetch HTML. It also includes a clear success/failure result box for getHtml(), which helps beginners connect headless lifecycle state (isRunning()) to safe controller use.
| Button | Expected result | Learning goal |
|---|---|---|
| Run | Starts headless webview | run() lifecycle |
| Send console.log | Message appears only if running | Guarded controller access |
| Dispose | Stops and resets UI state | Explicit teardown |
| Test getHtml | Green success or red failure | DOM retrieval verification |
Sources: headless_in_app_webview.screen.dart headless_in_app_webview.screen.dart headless_in_app_webview.screen.dart
Screen 6: Passkey Test (macOS Route)
Section titled “Screen 6: Passkey Test (macOS Route)”The passkey screen is a focused WebAuthn diagnostic view. It loads a test page, listens to bridge events (passkeyEvent), prints an event log, and derives a simple verdict banner. For beginners, this is the clearest example of JS-to-Dart event wiring in the app.
Sources: passkey_example.screen.dart passkey_example.screen.dart passkey_example.screen.dart passkey_example.screen.dart
Screen 7: First-Load Race Stress
Section titled “Screen 7: First-Load Race Stress”This is an advanced reliability demo with beginner-friendly output: two stress buttons and readable logs. It exists to reproduce a startup timing issue and verify readiness behavior. If you are new, treat it as a diagnostic screen, not a normal feature demo.
sequenceDiagram participant U as User participant S as Stress Screen participant W as Fresh Headless WebView U->>S: Tap stress S->>W: Create + run W-->>S: Ready S->>W: Immediate loadUrl W-->>S: loadStop + HTML markerSources: first_load_race.screen.dart first_load_race.screen.dart first_load_race.screen.dart first_load_race.screen.dart
Beginner Troubleshooting Map
Section titled “Beginner Troubleshooting Map”| Symptom | First check | Most likely explanation |
|---|---|---|
| Menu item missing | Your platform branch in main.dart |
Drawer is platform-filtered by design |
| “not running” snackbar on headless screen | Tap Run first | Controller access is guarded by run state |
| Passkey page does not authenticate | URL origin and platform setup | WebAuthn is origin/domain sensitive |
| Edge-to-edge has no visible change | Host activity edge-to-edge config | WebView setting alone is incomplete |
| Network Capture item does nothing | Route registry | Menu references /NetworkCapture, but no route/screen is registered in current code |
Sources: main.dart headless_in_app_webview.screen.dart passkey_example.screen.dart in_app_webview_edge_to_edge.screen.dart main.dart
Where to Go Next
Section titled “Where to Go Next”Read in this order for the smoothest progression: Quick Start: Your First Inline WebView, then InAppWebView Widget and InAppWebViewController, then Headless WebView and the Live-Instance Cap. After that, continue to In-App Browser and Chrome Custom Tabs and WebAuthn and Passkey Bridge based on the screen you need most.