pichillilorenzo / flutter_inappwebview

A Flutter plugin that allows you to add an inline webview, to use a headless webview, and to open an in-app browser window.
https://inappwebview.dev
Apache License 2.0
3.22k stars 1.58k forks source link

Support for Flutter Desktop #460

Open d0mmi opened 4 years ago

d0mmi commented 4 years ago

Environment

Flutter version: newest Plugin version: newest Android version: - iOS version: - Xcode version: - Device information: Windows / Linux / MacOS Desktop

Description

What you'd like to happen: I would like to have this to be compatible with the Flutter Desktop version. Most important for me would be the Flutter Desktop for Windows.

pichillilorenzo commented 8 months ago

A little update here:

WINDOWS

I have used and modified the C++ code used by webview_windows to have some initial Platform View on Windows working to be able to implement the InAppWebView widget as a Flutter Texture, using the native ICoreWebView2CompositionController class to support visual hosting. Unfortunately, there are some limitations, for example possible problems with scrolling inner HTML elements and, maybe, the rendering of the default context menu (I need to check about that, but currently, the default one is not rendering at the correct position for some strange reason). I don't know if these issues are bugs of ICoreWebView2CompositionController or if visual hosting is not working correctly when used with Flutter itself for some reason. At least, we should have something, but it could not be usable in all possible use cases because of these issues.

Instead, InAppBrowser is not suffering from these issues because uses a native window (as we have on macOS).

Currently, I'm working on setting up some JavaScript handlers communication and the User Scripts feature as we have already on Android/iOS/macOS.


MACOS

In the meantime, I have also checked the status of the AppKitView class for implementing the InAppWebView widget on macOS, but it's still not usable. Currently, it just renders the native view correctly but you can't interact with it (so: no click, no scroll, etc..), but, at least, the webview controller methods can be used (for example, you will able to evaluate javascript).

I need to try to implement something that wraps it, for example using MouseRegion, to check if we can create a workaround about it somehow and dispatch the gestures natively by ourselves. If it is not possible to implement such workaround for some reason, we can still use the version without interaction, just to display the content and hope the Flutter team adds full support about it as soon as possible.

jmgeffroy commented 8 months ago

@pichillilorenzo Thanks for the update and congratulations on your fantastic work! I don't have time to help, but I'm following your progress as I'm using your InAppWebView in an open source Epub reader (Iridium) and in soon to be released language learning apps based on this Epub reader. Iridium is not actively maintained at the moment, as the number of open issues and PRs shows, but I'm planning an iteration soon, and I'd be very happy to test any experimental version you might release. Extending the reach of our Epub reader from Android+iOS to other platforms will be very exciting .

Our Epub viewing component relies on a rather complex combination of InAppWebViews (they are laid out inside a PreloadPageView, the content of each WebView is paginated, and scrolling between WebViews and the enclosing PageView is handled thanks to positioned elements that trigger notifications when they become visible). In our private version, we also use the HeadlessInAppWebView to take screenshots of each page to provide thumbnails.

I guess that's quite a good real-life use-case 😄

pichillilorenzo commented 8 months ago

Here is a little update about Windows. I managed to fix this:

Unfortunately, there are some limitations, for example possible problems with scrolling inner HTML elements and, maybe, the rendering of the default context menu (I need to check about that, but currently, the default one is not rendering at the correct position for some strange reason).

@jmgeffroy I have added an initial implementation of the HeadlessInAppWebView but I need to implement the method to capture screenshots, that should be easy.

I will implement the CookieManager next, but it seems to work differently than other platforms.

After that, I think I'm able to release an initial release 0.1.0 for Windows.

jmgeffroy commented 8 months ago

@pichillilorenzo Hi, thanks for the update, looks promising!

Keep it up!

raymeskhoury commented 5 months ago

Any further update on Windows? Anything I can help with?

bryanjorgeflores commented 3 months ago

Any update on this?

OlegNovosad commented 2 months ago

Any updates?

PedroFerreiraBento commented 2 months ago

Any updates about Windows support?

DomingoMG commented 2 months ago

Please avoid comments asking for updates.

We know that if there is no response, it means there is no new information. Instead, let's focus on how we can help meet current needs.

pichillilorenzo commented 1 week ago

With the next version 6.1.0 I'm going to release the initial Windows implementation. In the meantime, thanks for the support.

rchavik commented 1 week ago

With the next version 6.1.0 I'm going to release the initial Windows implementation. In the meantime, thanks for the support.

Macos now has webview support with flutter 3.24 iirc. Will this be included too?

pichillilorenzo commented 1 week ago

@rchavik My latest commit 2ff7e8875fdf42a04d5231c3db43368e25ca04ed contains the code to support also the InAppWebView widget on MacOS 👍

pichillilorenzo commented 1 week ago

Released new version 6.1.0 with Windows initial support and MacOS InAppWebView support

pichillilorenzo commented 1 week ago

I will try to update the plugin website docs for Windows as soon as possible.

pichillilorenzo commented 6 days ago

Updated plugin docs: