Skip to content

WebView for Flutter Desktop Apps using CEF(Chromium Embedded Framework)

License

Notifications You must be signed in to change notification settings

Kofhein/webview_cef

 
 

Repository files navigation

WebView CEF

Pub.dev likes Pub.dev points latest version Platform

Flutter Desktop WebView backed by CEF (Chromium Embedded Framework).

Requirements

  • Windows 7+
  • macOS 10.12+

How To Use

Windows

Inside your application folder, you need to add two lines in your windows\runner\main.cpp.(Because of Chromium multi process architecture.)

#include "webview_cef/webview_cef_plugin_c_api.h"

int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
                      _In_ wchar_t *command_line, _In_ int show_command) {
  //start cef deamon processes. MUST CALL FIRST
  initCEFProcesses();

When building the project for the first time, a prebuilt cef bin package (200MB, link in release) will be downloaded automatically, so you may wait for a longer time if you are building the project for the first time.

macOS

  1. Download prebuilt cef bundles from arm64 or intel depends on your target machine arch.

Note: You can also download universal binary for build an mac-universal app if you want to build an mac universal app. See #30. Thanks to @okiabrian123.

  1. Unzip the archive and put all files into macos/third/cef.

3 Run the example app.

**[HELP WANTED!]** Finding a more elegant way to distribute the prebuilt package.

Note: Currently the project has not been enabled with multi process support due to debug convenience. If you want to enable multi process support, you may want to enable multi process mode by changing the implementation and build your own helper bundle. (Finding a more elegant way in the future.)

Todos

PRs are welcome!

  • Windows support
  • macOS support
  • Linux support
  • Multi instance support
  • IME support
  • Mouse events support
  • JS bridge support
  • Release to pub
  • Trackpad support (flutter 3.3)
  • Better macOS binary distribution
  • Easier way to integrate macos helper bundles(multi process)
  • devTools support

Demo

This demo is a simple webview app that can be used to test the webview_cef plugin.

In Windows

demo_compressed image image image

In macOS

image image image

Thanks

This project is inspired from flutter_webview_windows

About

WebView for Flutter Desktop Apps using CEF(Chromium Embedded Framework)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 56.9%
  • C++ 42.3%
  • CMake 0.3%
  • Dart 0.2%
  • Objective-C 0.2%
  • Objective-C++ 0.1%