搜尋套件、儲存庫與 APP 分類

webview_windows 封面
套件詳情v0.4.0

webview_windows

一個基於 WebView2 的 Windows 平台網頁檢視器實作。

Windows
近 30 天下載
7.7萬
喜歡數
236
Pub 分數
140

安裝套件

flutter pub add webview_windows

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個 Flutter 套件,為 Windows 提供基於 WebView2 的網頁檢視器實作,可讓桌面應用程式順暢整合網頁內容。專為 Windows 平台設計,利用微軟的 WebView2 控制項,其基礎為 Chromium,確保現代網頁相容性與效能。此套件允許開發者顯示網頁、處理導航並從 Dart 與 JavaScript 互動。支援常見的網頁檢視器功能,如 URL 載入、導航事件與基本 scripting。非常適合在使用 Flutter 建構的 Windows 桌面應用中嵌入基於網頁的 UI 或內容。

適用情境

  • 在Windows桌面應用程式中嵌入網頁內容
  • 顯示動態的基於Web的介面
  • 將網路服務整合到桌面應用程式中
  • 使用 Web 組件建構混合桌面應用程式
  • 透過內嵌式網頁檢視建立豐富的使用者體驗

主要特色

  • 基於 WebView2 的 Windows 渲染
  • 基於 Chromium 的網頁引擎
  • JavaScript 互動支援
  • 導航事件處理
  • 跨平台相容 Flutter 桌面

適合對象

  • 面向 Windows 桌面的 Flutter 開發人員
  • 需要嵌入網頁內容的應用程式
  • 使用 Web 組件的混合桌面應用程式
  • 需要在 Windows 上進行現代 Web 渲染的開發者
  • 使用 WebView2 實現 Windows 特定功能的專案

使用建議

  • 僅限 Windows 平台支援
  • 需要安裝 WebView2 執行時間
  • 僅限 Windows 桌面環境
  • 可能需要額外的設定才能用於生產部署
  • 取決於目標系統上的 WebView2 控制項可用性

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

webview_windows

CI Pub

A Flutter WebView plugin for Windows built on Microsoft Edge WebView2.

Target platform requirements
  • WebView2 Runtime
    Before initializing the webview, call getWebViewVersion() to check whether the required WebView2 Runtime is installed or not on the current system. If getWebViewVersion() returns null, guide your user to install WebView2 Runtime from this page.
  • Windows 10 1809+
Development platform requirements
  • Visual Studio 2019 or higher
  • Windows 11 SDK (10.0.22000.194 or higher)
  • (recommended) nuget.exe in your $PATH (The makefile attempts to download nuget if it's not installed, however, this fallback might not work in China)

Demo

image

https://user-images.githubusercontent.com/720469/116716747-66f08180-a9d8-11eb-86ca-63ad5c24f07b.mp4

Limitations

This plugin provides seamless composition of web-based contents with other Flutter widgets by rendering off-screen.

Unfortunately, Microsoft Edge WebView2 doesn't currently have an explicit API for offscreen rendering. In order to still be able to obtain a pixel buffer upon rendering a new frame, this plugin currently relies on the Windows.Graphics.Capture API provided by Windows 10. The downside is that older Windows versions aren't currently supported.

Older Windows versions might still be targeted by using BitBlt for the time being.

See:

  • https://github.com/MicrosoftEdge/WebView2Feedback/issues/20
  • https://github.com/MicrosoftEdge/WebView2Feedback/issues/526
  • https://github.com/MicrosoftEdge/WebView2Feedback/issues/547

所屬分類

原始碼儲存庫

使用此套件的專案