Widget webview() {
return Container(
child: Padding(
padding: EdgeInsets.all(30.0),
child: Row(
// mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
new GestureDetector(
child: Text(
'About',
style: TextStyle(fontSize: 16.0, color: const Color(0XFF5867DD)),
),
onTap: () {
openWebview();
},
),
],
),
));
}
Widget openWebview() {
return Container(
child: WebviewScaffold(
url: "https:www.google.com/",
withZoom: true,
withLocalStorage: true,
),
);
}
}
我正在我的 flutter 应用程序中创建 webview,问题是我想在单击 textview 时在对话框中打开 webview。
最佳答案
只需将它包裹在 MaterialPageRoute 中即可
Widget openWebview() {
Navigator.of(context).push(new MaterialPageRoute<Null>(
builder: (BuildContext context) {
return Container(
child: WebviewScaffold(
url: "https:www.google.com/",
withZoom: true,
withLocalStorage: true,
),
);
},
fullscreenDialog: false
));
}
关于对话框内的 Flutter webview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54904055/