Flutter 扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑;“onEnterFullscreen”;

Flutter 扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑扑;“onEnterFullscreen”;,flutter,dart,Flutter,Dart,当用户单击全屏视频时,AppWebView中的颤振颤振旋转为横向。在文档中,Flitter_inappwebview说 OneInterFullScreen:当前页面已进入完整页面时激发的事件 屏幕模式 Container( height: globals.screenHeight * 0.25, color: Colors.white, child: Column(children: <Widget>[ Expan

当用户单击全屏视频时,AppWebView中的颤振颤振旋转为横向。在文档中,Flitter_inappwebview说

  • OneInterFullScreen:当前页面已进入完整页面时激发的事件 屏幕模式

       Container(
           height: globals.screenHeight * 0.25,
           color: Colors.white,
           child: Column(children: <Widget>[
             Expanded(
               child: Container(
                 margin: const EdgeInsets.all(0.0),
                 decoration: BoxDecoration(
                     border: Border.all(color: Colors.blueAccent)),
                 child: InAppWebView(
                   initialUrl:
                       "http://URL/play.html?name=123456789",
                   initialHeaders: {},
                   onWebViewCreated: (InAppWebViewController controller) {
                     webView = controller;
                   },
                   onEnterFullscreen: AutoOrientation.landscapeAutoMode(),
                   onLoadStart:
                       (InAppWebViewController controller, String url) {
                     setState(() {
                       this.url = url;
                     });
                   },
                   onLoadStop: (InAppWebViewController controller,
                       String url) async {
                     setState(() {
                       this.url = url;
                     });
                   },
                   onProgressChanged:
                       (InAppWebViewController controller, int progress) {
                     setState(() {
                       this.progress = progress / 100;
                     });
                   },
                 ),
               ),
             ),
           ]
         )
       ),
    
  • onExitFullscreen:当前页面退出时激发的事件 全屏模式

       Container(
           height: globals.screenHeight * 0.25,
           color: Colors.white,
           child: Column(children: <Widget>[
             Expanded(
               child: Container(
                 margin: const EdgeInsets.all(0.0),
                 decoration: BoxDecoration(
                     border: Border.all(color: Colors.blueAccent)),
                 child: InAppWebView(
                   initialUrl:
                       "http://URL/play.html?name=123456789",
                   initialHeaders: {},
                   onWebViewCreated: (InAppWebViewController controller) {
                     webView = controller;
                   },
                   onEnterFullscreen: AutoOrientation.landscapeAutoMode(),
                   onLoadStart:
                       (InAppWebViewController controller, String url) {
                     setState(() {
                       this.url = url;
                     });
                   },
                   onLoadStop: (InAppWebViewController controller,
                       String url) async {
                     setState(() {
                       this.url = url;
                     });
                   },
                   onProgressChanged:
                       (InAppWebViewController controller, int progress) {
                     setState(() {
                       this.progress = progress / 100;
                     });
                   },
                 ),
               ),
             ),
           ]
         )
       ),
    
    容器(
    高度:globals.screenHeight*0.25,
    颜色:颜色,白色,
    子项:列(子项:[
    扩大(
    子:容器(
    边距:所有常数边集(0.0),
    装饰:盒子装饰(
    边框:border.all(颜色:Colors.blueAccent)),
    子:InAppWebView(
    初始URL:
    "http://URL/play.html?name=123456789",
    initialHeaders:{},
    onWebViewCreated:(InAppWebViewController){
    网络视图=控制器;
    },
    OneInterFullScreen:AutoOrientation.landscapeAutoMode(),
    加载启动:
    (InAppWebViewController控制器,字符串url){
    设置状态(){
    this.url=url;
    });
    },
    onLoadStop:(在AppWebViewController中,
    字符串url)异步{
    设置状态(){
    this.url=url;
    });
    },
    已更改的进程:
    (InAppWebViewController,int进度){
    设置状态(){
    这个。进度=进度/100;
    });
    },
    ),
    ),
    ),
    ]
    )
    ),
    
当页面加载时,手机自动横向移动,我收到了这个错误


我想要的是,当用户单击全屏时,视频自动横向显示

问题是
oneterfullscreen
正在等待
(InAppViewController)=>void
,但您正在分配
自动定向的结果。landscapeAutoMode()

oneterfullscreen:AutoOrientation.landscapeAutoMode(),
因此,每次调用
build
方法时,都会对该函数进行求值。这就是为什么你会有这两种奇怪的行为:

  • 加载时自动横向移动
  • 异常,因为类型不匹配
要解决此问题,您需要以以下方式分配回调:

oneterfullscreen:(控制器){AutoOrientation.landscapeAutoMode()},