首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >webview_flutter 3.0.0问题解决( onWebViewCreated )

webview_flutter 3.0.0问题解决( onWebViewCreated )
EN

Stack Overflow用户
提问于 2021-12-15 10:28:52
回答 2查看 730关注 0票数 1

问题所在

我使用的是web视图flutter 3.0.0,它不想为(在Web视图上创建)接受任何东西。。。所以如果有人能解决我要感恩

EN

回答 2

Stack Overflow用户

发布于 2021-12-15 10:32:40

代码语言:javascript
复制
  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',
     );
   }
 }
票数 0
EN

Stack Overflow用户

发布于 2022-01-06 08:29:06

删除WebView小部件之前的const关键字。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70362094

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档