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,
);
}
}
Flutter Webview页面下弹框
最新推荐文章于 2024-09-20 22:35:00 发布