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.3k stars 1.63k forks source link

Allow preload / prerender with a HeadlessInappWebView and transform it into an InAppWebView #1081

Closed jmgeffroy closed 1 month ago

jmgeffroy commented 2 years ago

Hi there, congrats on this great webview integration. We are developing an epub reader SDK, where each chapter (HTML) is rendered by a webview. Webviews are placed in a PreloadPageView, which can pre-build as many pages as we specify through a preloadPageCountparam. When using Virtual Displays on Android, offscreen webviews are pre-rendered and everything is OK, except that animations when swiping to turn pages aren't smooth. So we need to use Hybrid Composition, which also happens to be the only option available on iOS, BTW.

I tried bothwebview_flutter and flutter_inappwebview, same behavior.

So I am thinking about the best way to have prerendering working even with hybrid composition. An obvious path would be to use the HeadlessInappWebView. We could use it to generate images of each chapter page and place them in a listview. Then, once a chapter becomes visible, we replace this list of images with a real InAppWebView. Of course, this is doable and would work, but it is far from being elegant. So I was wondering if it wouldn't be smarter to provide means to dynamically attach a HeadlessInAppWebView to the view tree and transform it into an InAppWebView?

github-actions[bot] commented 2 years ago

👋 @jmgeffroy

NOTE: This comment is auto-generated.

Are you sure you have already searched for the same problem?

Some people open new issues but they didn't search for something similar or for the same issue. Please, search for it using the GitHub issue search box or on the official inappwebview.dev website, or, also, using Google, StackOverflow, etc. before posting a new one. You may already find an answer to your problem!

If this is really a new issue, then thank you for raising it. I will investigate it and get back to you as soon as possible. Please, make sure you have given me as much context as possible! Also, if you didn't already, post a code example that can replicate this issue.

In the meantime, you can already search for some possible solutions online! Because this plugin uses native WebView, you can search online for the same issue adding android WebView [MY ERROR HERE] or ios WKWebView [MY ERROR HERE] keywords.

Following these steps can save you, me, and other people a lot of time, thanks!

TheCarpetMerchant commented 2 years ago

@jmgeffroy Did you end up finding a solution to this ?

github-actions[bot] commented 1 month ago

This issue is stale and has been automatically closed because it has been open for more than 365 days with no activity. Please reopen a new issue if you still have it.

github-actions[bot] commented 2 weeks ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.