@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
bottomNavigationBar: _bottomTab(),
appBar: AppBar(
title: Text('View ' + type),
actions: [
IconButton(
icon: Icon(Icons.print),
onPressed: () {
// getPermission('print');
printPdfFile();
}),
IconButton(
icon: Icon(Icons.edit),
onPressed: () {
navigateTo();
}),
],
),
body: Stack(
children: <Widget>[
Align(
alignment: Alignment.center,
child:
Visibility(visible: true, child: CircularProgressIndicator()),
),
Align(
alignment: Alignment.center,
child: Container(
color: Colors.white,
height: MediaQuery.of(context).size.height / 1.5,
child: WebviewScaffold(
url: weburl,
displayZoomControls: true,
withJavascript: true,
// scrollBar: true,
withZoom: true,
hidden: true,
// bottomNavigationBar: _bottomTab(),
),
),
),
// WebviewScaffold(
// url: weburl,
// withZoom: true,
// hidden: true,
// appBar: AppBar(
// title: Text('View ' + type),
// actions: [
// IconButton(
// icon: Icon(Icons.print),
// onPressed: () {
// getPermission('print');
// }),
// ],
// ),
// bottomNavigationBar: _bottomTab(),
// )
],
),
);
}我在flutter application.The中实现webview的问题是,当我最初打开小工具时,默认情况下我的webview是缩放的。我不想要它,假设用户想要缩放屏幕,他们可以,但在默认情况下,我不希望网页视图在打开页面时处于缩放状态。
发布于 2021-09-02 12:28:48
请记住,我用dartPad编写了一段很脏的代码,所以可能会遗漏了一些结束标记
,然后展开子列
return Scaffold(
backgroundColor: Colors.white,
bottomNavigationBar: _bottomTab(),
appBar: AppBar(
title: Text('View ' + type),
actions: [
IconButton(
icon: Icon(Icons.print),
onPressed: () {
// getPermission('print');
printPdfFile();
}),
IconButton(
icon: Icon(Icons.edit),
onPressed: () {
navigateTo();
}),
],
),
body: _isLoading
? CircularProgressIndicator()
: Column(children: [
Expanded(
child: WebviewScaffold(
url: weburl,
displayZoomControls: _enableZoom,
withJavascript: true,
withZoom: _enableZoom,
hidden: true,
),
),
],
),
);2禁止从webView进行默认缩放
注意这里有一个变量_enableZoom,在渲染之后你可以启用缩放。或者使用另一个用于缩放InteractiveViewer的小部件。
InteractiveViewer(
panEnabled: _zoomEnable,
child: WebviewScaffold(
url: weburl,
displayZoomControls: false,
withJavascript: true,
withZoom: false,
hidden: true,
....https://stackoverflow.com/questions/69029965
复制相似问题