我正在运行颤振 1.17.1,使用 webview_flutter: ^0.3.21 依赖项添加到 pubspec.yaml 并将其添加到 info.plist 的末尾
<key>io.flutter.embedded_views_preview</key>
<string>YES</string>
问题:加载到 webview 的网页太大,手机屏幕放不下。 截屏
这是带有 webview 的代码:
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
class WebViewContainer extends StatefulWidget {
final url;
WebViewContainer(this.url);
@override
createState() => _WebViewContainerState(this.url);
}
class _WebViewContainerState extends State<WebViewContainer> {
var _url;
final _key = UniqueKey();
_WebViewContainerState(this._url);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Column(
children: [
Expanded(
child: WebView(
key: _key,
javascriptMode: JavascriptMode.unrestricted,
initialUrl: _url))
],
));
}
}