简体   繁体   English

Flutter 中是否会有来自本地资产 html 文件的离线 web 视图?

[英]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.

相关问题 XSLT collection()在html文件上不起作用 - XSLT collection() not working on html-files 本地颤振资产图像未显示在 html 小部件中 - local flutter asset image not showing in html widget 使用批处理(.bat)脚本从HTML文件中删除行(或标签) - Delete lines (or tag) from HTML-Files using batch (.bat) script 如何将资产文件夹中的html加载到webview中 - How to load html from asset folder into webview Android:具有本地目录或服务器中html文件的WebView - Android: WebView with html files from local dir or server jQuery脚本未在angular包含的html文件中运行 - Jquery script not running in html-files included by angular 素材资源未在flutter-ios中呈现的图像。 如何在html内渲染本地资产图像 <img src…> 在不使用webview的情况下进行标记? - Assets Images not rendering in flutter-ios. How to render local asset-images inside html <img src…> tag in flutter without using webview? 如何在PyCharm 2016中为HTML文件启用自动弹出建议列表 - How to enable autopopup suggestion list for html-files in PyCharm 2016 Flutter:如何在 webview 中显示本地 html 文件? - Flutter: How show local html file in webview? WebView不适用于本地HTML文件 - WebView does not work with local HTML files
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM