搜索插件、代码仓与 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 加载、导航事件和基本脚本。非常适合在使用 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

所属分类

源码仓库

使用此插件的项目