|
@@ -7,6 +7,8 @@ import 'package:zhiying_comm/util/log/let_log.dart'; |
|
|
import 'package:zhiying_comm/util/empty_util.dart'; |
|
|
import 'package:zhiying_comm/util/empty_util.dart'; |
|
|
import 'package:url_launcher/url_launcher.dart'; |
|
|
import 'package:url_launcher/url_launcher.dart'; |
|
|
import 'package:webview_flutter/webview_flutter.dart'; |
|
|
import 'package:webview_flutter/webview_flutter.dart'; |
|
|
|
|
|
import 'package:zhiying_comm/util/shared_prefe_util.dart'; |
|
|
|
|
|
import 'package:zhiying_comm/util/global_config.dart'; |
|
|
|
|
|
|
|
|
class BaseWebview extends StatefulWidget { |
|
|
class BaseWebview extends StatefulWidget { |
|
|
final Map<String, dynamic> model; |
|
|
final Map<String, dynamic> model; |
|
@@ -21,13 +23,23 @@ class _BaseWebviewState extends State<BaseWebview> { |
|
|
String _url; |
|
|
String _url; |
|
|
String _title; |
|
|
String _title; |
|
|
WebViewController _webViewController; |
|
|
WebViewController _webViewController; |
|
|
|
|
|
bool _isiOSReview = false; |
|
|
|
|
|
|
|
|
@override |
|
|
@override |
|
|
void initState() { |
|
|
void initState() { |
|
|
_url = widget.model['url'] ?? ''; |
|
|
_url = widget.model['url'] ?? ''; |
|
|
|
|
|
_settingIosReview(); |
|
|
super.initState(); |
|
|
super.initState(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void _settingIosReview() async { |
|
|
|
|
|
String is_ios_review = await SharedPreferencesUtil.getStringValue(GlobalConfig.IS_IOS_REVIEW, defaultVal: '0'); |
|
|
|
|
|
setState(() { |
|
|
|
|
|
if (is_ios_review == '1') { |
|
|
|
|
|
_isiOSReview = true; |
|
|
|
|
|
print(_isiOSReview); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
@override |
|
|
@override |
|
|
Widget build(BuildContext context) { |
|
|
Widget build(BuildContext context) { |
|
|
return Scaffold( |
|
|
return Scaffold( |
|
@@ -103,10 +115,7 @@ class _BaseWebviewState extends State<BaseWebview> { |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
trailing: GestureDetector( |
|
|
trailing: GestureDetector( |
|
|
child: Icon( |
|
|
|
|
|
Icons.refresh, |
|
|
|
|
|
size: 20, |
|
|
|
|
|
), |
|
|
|
|
|
|
|
|
child: _isiOSReview ? Container() : Icon(Icons.refresh, size: 20,), |
|
|
onTap: () { |
|
|
onTap: () { |
|
|
_webViewController.reload(); |
|
|
_webViewController.reload(); |
|
|
}, |
|
|
}, |
|
|