如何在Flutter中添加Webview? [英] How to add a Webview in Flutter?

查看:230
本文介绍了如何在Flutter中添加Webview?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道可以将WebView添加为整页,但是找不到任何示例代码来完成.我假设您可以使用PageView作为其基础,但不确定如何调用本地android WebView并将其添加到PageView.

I know its possible to add a WebView as a full page but couldn't find any sample code to do it. I assume you could use a PageView as it's base but not sure how to call the native android WebView and add it to the PageView.

有人能指出我正确的方向吗?

Can anyone point me in the right direction?

推荐答案

您可以使用 https://pub .dartlang.org/packages/webview_flutter

示例

import 'package:webview_flutter/webview_flutter.dart';

return Scaffold(
      appBar: AppBar(
        title: const Text('Flutter WebView example'),
      ),
      body: const WebView(
        initialUrl: 'https://flutter.io',
        javascriptMode: JavascriptMode.unrestricted,
      ),
    );

这篇关于如何在Flutter中添加Webview?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆