【发布时间】:2022-01-18 13:04:47
【问题描述】:
我正在使用 web view flutter 3.0.0,它不想接受任何东西(在 Web View Created 上).. .. 所以如果有人能解决,请不胜感激
【问题讨论】:
标签: flutter webview android-webview
我正在使用 web view flutter 3.0.0,它不想接受任何东西(在 Web View Created 上).. .. 所以如果有人能解决,请不胜感激
【问题讨论】:
标签: flutter webview android-webview
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',
);
}
}
【讨论】: