[英]Will there be an offline webview from local asset html-files in Flutter?
I guess this is just another feature request for Flutter presenting a local webpage as a WebView Widget - and all of it OFFLINE and originating from html, css and other asset files.我想这只是 Flutter 将本地网页呈现为 WebView 小部件的另一个功能请求 - 所有这些都脱机并源自 html、css 和其他资产文件。
There are several Flutter plugins that are able to show a webView from a URL (being online) - but I haven't seen a solution yet for presenting a WebView from local assets offline.有几个 Flutter 插件可以从 URL 显示 webView(在线) - 但我还没有看到从本地资产离线显示 WebView 的解决方案。
A typical webpage with several pages (files and folders placed in the Flutter assets) would look like this:具有多个页面(放置在 Flutter 资产中的文件和文件夹)的典型网页如下所示:
index.html
page1.html
page2.html
/images/img1.jpg
/images/img2.jpg
/css/p1.css
/css/p2.css
etc.
I read the following discussions (see links below) and more but I don't grasp from it if there will ever be the technical possibility in Flutter for an offline WebView Widget or not.我阅读了以下讨论(请参阅下面的链接)以及更多内容,但我不明白 Flutter 中是否存在用于离线 WebView Widget 的技术可能性。
Is it just a matter of time we have to wait for a plugin-team to implement this - or will this never be possible in Flutter at all ?我们必须等待插件团队来实现这一点只是时间问题 - 或者这在 Flutter 中永远不可能实现? I would like to receive a more fundamental answer than what I am able to grasp after having played with Flutter for 5-6 weeks.在使用 Flutter 5-6 周后,我希望得到一个比我能够理解的更基本的答案。
Here is some discussion I've found about the subject:以下是我发现的有关该主题的一些讨论:
How to display custom html instead of URL #23 如何显示自定义 html 而不是 URL #23
Load HTML from assets or local files #27086从资产或本地文件加载 HTML #27086
The inAppWebView
plugin does this procedure to read offline html file or online: inAppWebView
插件执行此过程以读取离线 html 文件或在线:
Link to the plugin: https://pub.dev/packages/flutter_inappwebview#-installing-tab-插件链接: https : //pub.dev/packages/flutter_inappwebview#-installing-tab-
Example:例子:
InAppWebView(
initialFile: "assets/index.html"
)
Where in initialFile you pass the path of your HTML file that is inside your flutter project.在 initialFile 中,您传递 flutter 项目中 HTML 文件的路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.