显示WEB页面
import 'dart:convert';
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
import 'package:http/http.dart' as http;
class WebViewDemo extends StatefulWidget {
final String title;
final String url;
WebViewDemo({this.title, this.url});
@override
State<StatefulWidget> createState() {
return WebViewState();
}
}
class WebViewState extends State<WebViewDemo> {
var httpClient = new HttpClient();
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: WebviewScaffold(
url: this.widget.url,
appBar: AppBar(
elevation: 0,
title: Text(this.widget.title),
leading: GestureDetector(
onTap: back,
child: Icon(Icons.arrow_back_ios),
),
actions: <Widget>[
GestureDetector(
onTap: () {
},
child: Icon(Icons.share),
),
],
),
withZoom: true,
withLocalStorage: true,
hidden: true,
initialChild: Container(
child: Center(
child: CupertinoActivityIndicator(),
),
),
),
);
}
back() {
print(this.widget.url);
Navigator.pop(context);
}
}