flutter - Flutter webview 无法将网页与屏幕匹配
问题描述
我正在使用 webview_flutter:^0.3.14+1。
Webview 无法正确加载网页https://m.bilibili.com/video/av57346110.html
。网页过大
但是如果我用 chrome 打开它,网页会正确地适合屏幕。
而且我不明白网络浏览器和flutter webview之间的区别。
这是重现的最少代码:
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
void main() => runApp(new MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new Scaffold(
appBar: new AppBar(),
body: Container(
child: WebView(
initialUrl: "https://m.bilibili.com/video/av57346110.html",
javascriptMode: JavascriptMode.unrestricted,
navigationDelegate: (NavigationRequest request) {
print("Loading... ${request.url}");
if(request.url.startsWith("http")) {
return NavigationDecision.navigate;
} else {
return NavigationDecision.prevent;
}
},
),
),
),
);
}
}
解决方案
推荐阅读
- javascript - Multer 在上传文件时抛出错误
- node.js - req.user 是否保证是有效的、经过身份验证的用户?[护照.js]
- json - 将简单的 json 数组转换为纯文本
- django-rest-framework - 如何覆盖 APIView 中的 get_serializer_class 以根据特定条件更改基于类的视图中的 serializer_class 属性。?
- python - 有没有办法优化熊猫中的 itterrows 代码?
- python - 如何解决 python 脚本中找不到文件的问题?
- android - 检索在 MainActivity 类的另一个类中设置的意图额外键值
- mysql - 为 MYSQL 中某个时间段内的每一天添加行
- r - R rmcorr 不正确的自由度数
- javascript - 为什么 Node.js 垃圾收集器不收集 new Function() 的“编译代码”?