|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|
|
|
import 'package:huixiang/generated/l10n.dart';
|
|
|
|
import 'package:huixiang/view_widget/my_appbar.dart';
|
|
|
|
import 'package:webview_flutter/webview_flutter.dart';
|
|
|
|
|
|
|
|
class ScanWeb extends StatefulWidget {
|
|
|
|
final Map<String, dynamic> arguments;
|
|
|
|
|
|
|
|
ScanWeb({this.arguments});
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() {
|
|
|
|
return _ScanWeb();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _ScanWeb extends State<ScanWeb> {
|
|
|
|
var controller = new ScrollController();
|
|
|
|
WebViewController webViewController;
|
|
|
|
String result;
|
|
|
|
String title;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
result = widget.arguments["result"];
|
|
|
|
title = widget.arguments["title"];
|
|
|
|
EasyLoading.show(status: S.current.zhengzaijiazai);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
appBar: MyAppBar(
|
|
|
|
title:title ?? "",
|
|
|
|
titleColor: Colors.black,
|
|
|
|
background: Colors.transparent,
|
|
|
|
leadingColor: Colors.black,
|
|
|
|
),
|
|
|
|
body:
|
|
|
|
WebView(
|
|
|
|
initialUrl:result,
|
|
|
|
javascriptMode: JavascriptMode.unrestricted,
|
|
|
|
onWebViewCreated: (WebViewController controller){
|
|
|
|
webViewController =controller;
|
|
|
|
},
|
|
|
|
onProgress: (int progress) async {
|
|
|
|
if(widget.arguments["title"] != null)
|
|
|
|
return;
|
|
|
|
title = await webViewController?.getTitle();
|
|
|
|
setState((){});
|
|
|
|
EasyLoading.dismiss();
|
|
|
|
},
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|