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。
答案 0 :(得分:0)
只需像
一样将其包装在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
));
}