You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.0 KiB

3 years ago
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:huixiang/generated/l10n.dart';
4 years ago
import 'package:huixiang/view_widget/my_appbar.dart';
3 years ago
import 'package:webview_flutter/webview_flutter.dart';
3 years ago
class TreatyPage extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _TreatyPage();
}
}
class _TreatyPage extends State<TreatyPage> {
var controller = new ScrollController();
late WebViewController _webViewController;
4 years ago
@override
void initState() {
super.initState();
EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black);
_webViewController = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setNavigationDelegate(
NavigationDelegate(
onProgress: (int progress) {},
onPageStarted: (String url) {},
onPageFinished: (String url) {
EasyLoading.dismiss();
},
onWebResourceError: (WebResourceError error) {},
onNavigationRequest: (NavigationRequest request) {
// if (request.url.startsWith('https://www.youtube.com/')) {
// return NavigationDecision.prevent;
// }
return NavigationDecision.navigate;
},
),
)
..loadRequest(Uri.parse("http://huixiang.lotus-wallet.com/Privacy.html"));
4 years ago
}
@override
Widget build(BuildContext context) {
return Scaffold(
4 years ago
appBar: MyAppBar(
3 years ago
title:S.of(context).yinsishengming,
4 years ago
titleColor: Colors.black,
background: Colors.transparent,
leadingColor: Colors.black,
),
3 years ago
body:
Container(
3 years ago
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
alignment: Alignment.center,
child:
WebViewWidget(
controller: _webViewController,
),
),
);
}
}