wsloth / Index

The Index is a simple Hacker News reader app which is focused on making you read less, by only showing you the top stories of the last 24 hours.
10 stars 9 forks source link

Improve flutter webview performance and experience #8

Open wsloth opened 2 years ago

wsloth commented 2 years ago

Right now, when viewing an article the experience is not ideal:

sander1095 commented 2 years ago

I have 0 real flutter experience, but this does sound kind of odd.

I have some Android experience, so I looked around at the implementation of the android version:

It seems that the webview_flutter package does use android's webview under the hood. Android would ideally recommend that you just switch to a browser, but provides alternatives like using custom tabs.

Perhaps that is worth looking into?

I have not a lot of knowledge about opening PDF's in a webview, if that is supported and also best practice. A more low level fix I can come up with is to check the Content-Type header of the request and let the system handle it using an intent? For example, what app would Android prefer to use for application/pdf? But I am pretty sure this is not the way to go; just a random guess! :)

wsloth commented 2 years ago

Thanks for the pointers @sander1095! I'm currently not interested in using an on-device browser window, as the comment section is overlayed on the article using a slide-up tab for a seamless user experience.

Your idea about the file/page content type check could be worth checking out. In that case, I could substitute the webview renderer with a pdf rendering library and still have the same comment section overlay experience.

If anybody wants to pick up this issue, let me know! Otherwise I'll get around to it someday ;)