我使用的是web视图flutter 3.0.0,它不想为(在Web视图上创建)接受任何东西。。。所以如果有人能解决我要感恩
发布于 2021-12-15 10:32:40
android {
defaultConfig {
minSdkVersion 19
}
}
Using Virtual displays
Set the correct minSdkVersion in android/app/build.gradle (if it was previously lower than 20):
android {
defaultConfig {
minSdkVersion 20
}
}
Set WebView.platform = AndroidWebView(); in initState(). For example:
import 'dart:io';
import 'package:webview_flutter/webview_flutter.dart';
class WebViewExample extends StatefulWidget {
@override
WebViewExampleState createState() => WebViewExampleState();
}
class WebViewExampleState extends State<WebViewExample> {
@override
void initState() {
super.initState();
// Enable virtual display.
if (Platform.isAndroid) WebView.platform = AndroidWebView();
}
@override
Widget build(BuildContext context) {
return WebView(
initialUrl: 'https://flutter.dev',
);
}
}发布于 2022-01-06 08:29:06
删除WebView小部件之前的const关键字。
https://stackoverflow.com/questions/70362094
复制相似问题