webview在加载页面的时候,有时候会出现黑屏。
Stack(
children: <Widget>[
Builder(builder: (BuildContext context) {
return WebView(
initialUrl: "${GlobalConfig.baseApiHost}/PrivacyPolicy.html",
//JS执行模式 是否允许JS执行
javascriptMode: JavascriptMode.unrestricted,
onPageFinished: (String s) {
setState(() {
loading = false;
});
},
);
}),
Offstage(
offstage: !loading,
child: Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
color: Colors.white,
),
),
],
)