Flutter开发之WebView加载网页(24)

在这里插入图片描述WebView 是一个重要的控件,它用来加载网页、HTML、文件等。它的使用也很简单。今天就学习下Flutter下的WebView如何加载网页。

使用教程地址:https://pub.flutter-io.cn/packages/flutter_webview_plugin#-installing-tab-

安装flutter_webview_plugin插件
  1. Add this to your package’s pubspec.yaml file:
dependencies:
  flutter_webview_plugin: ^0.3.5
  1. You can install packages from the command line:
$ flutter pub get
  1. 查看插件安装成功与否:左侧flutter_webview_plugin包出现
    在这里插入图片描述

  2. 导入使用

import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
  1. 加载百度页面效果
body: Center(
        // Center is a layout widget. It takes a single child and positions it
        // in the middle of the parent.

        child:new WebviewScaffold(
          url: "https://www.baidu.com",
          appBar: new AppBar(
            title: new Text("加载了百度"),
          ),
        ),
),

在这里插入图片描述
加载出来了。。。在公司电脑死活不出来,气死我了。以后不用公司电脑配置环境了。


注意⚠️:
如果导入插件时,报gradle-3.2.1.pom 的错误。就重启一下电脑吧!

> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:3.2.1.
     Required by:
         project :
      > Could not resolve com.android.tools.build:gradle:3.2.1.
         > Could not get resource 'https://maven.aliyun.com/repository/google/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'
  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值