Flutter Webview页面下弹框

import 'package:flutter/material.dart';
import 'package:redenvelope/constant/colors.dart';
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
//二维码扫描插件
import 'package:flutter/services.dart';
import 'package:barcode_scan/barcode_scan.dart';
import 'package:flutter/rendering.dart';
import 'package:cool_ui/cool_ui.dart';
//文章详情界面
class WebViewtouzi extends StatefulWidget {
  String title;
  String url;
  var  actions;
  WebViewtouzi({
    Key key,
    @required this.title,
    @required this.url,
    @required this.actions,
  }) : super(key: key);

  @override
  State<StatefulWidget> createState() {
    return new WebViewPageState();
  }
}

class WebViewPageState extends State<WebViewtouzi> {

  bool isLoad = true;

  final flutterWebViewPlugin = new FlutterWebviewPlugin();

  @override
  void initState() {
    super.initState();
    flutterWebViewPlugin.onStateChanged.listen((state) {
      debugPrint('state:_' + state.type.toString());
      if (state.type == WebViewState.finishLoad) {
        // 加载完成
        setState(() {
          isLoad = false;
        });
      } else if (state.type == WebViewState.startLoad) {
        setState(() {
          isLoad = true;
        });
      }
    });
  }

  Container foot=  Container(child:Text(""));
  @override
  Widget build(BuildContext context) {
    return new WebviewScaffold(
      url: widget.url,
      appBar: new AppBar(
        backgroundColor: AppColors.colorAppBarBackground,
        elevation:0,
        centerTitle:true,
        /*actions: <Widget>[
          IconButton(
            icon:Icon(Icons.share,size:20) ,
            onPressed: (){
              print(123);
              setState(() {


                foot=new Container(
                  height: 200,
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: <Widget>[
                      SizedBox(height: 20,),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceAround,
                        children: <Widget>[
                        Text('分享到',style: TextStyle(fontSize:16,color: Colors.deepOrange),),
                        FlatButton(
                            child: Text('取消',style: TextStyle(fontSize:16,color: Colors.black45),),
                            onPressed: () async {
                                setState(() {
                                  foot=  Container(child:Text(""));
                                });
                            }
                        ),
                        ]
                      ),

                      SizedBox(height: 40,),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceAround,
                        children: <Widget>[
                          FlatButton(
                              child: Column(
                                children: <Widget>[
                                  Icon(FontAwesomeIcons.yenSign,color: Colors.orange,),
                                  SizedBox(height: 10,),
                                  Text("好友"),
                                ],
                              ),
                              onPressed: () async {

                              }
                          ),
                          FlatButton(
                              child: Column(
                                children: <Widget>[
                                  Icon(FontAwesomeIcons.weixin,color: Colors.lightGreen,),
                                  SizedBox(height: 10,),
                                  Text("微信"),
                                ],
                              ),
                              onPressed: (){

                              }
                          ),
                          FlatButton(
                              child: Column(
                                children: <Widget>[
                                  Icon(FontAwesomeIcons.alipay,color: Colors.blue,),
                                  SizedBox(height: 10,),
                                  Text("朋友圈"),
                                ],
                              ),
                              onPressed: (){

                              }
                          ),



                        ],
                      ),

                    ],
                  )
              );
              });
            },),

        ],*/
        leading: IconButton(
          icon:Icon(Icons.arrow_back_ios,size:20) ,
          onPressed: (){
            Navigator.pop(context);
          },),
        title: new Text(widget.title,
            style: new TextStyle(color: Colors.white,fontSize: 18)),

        bottom: new PreferredSize(
            preferredSize: const Size.fromHeight(1.0),
            child: isLoad
                ? new LinearProgressIndicator()
                : new Divider(
                    height: 1.0,
                    color: Theme.of(context).primaryColor,
                  )
        ),
      ),
      bottomNavigationBar:foot,
      withZoom: false,
      withLocalStorage: true,
      withJavascript: true,
    );
  }
}
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值