Flutter - Webview_plugin - I can't enable full screen with video

4,000

You can try my plugin flutter_inappbrowser (EDIT: it has been renamed to flutter_inappwebview).

An example with a youtube video is presented below:

...

child: InAppWebView(
  initialUrl: "https://www.youtube.com/watch?v=sPW7nDBqt8w",
  initialHeaders: {},
  initialOptions: InAppWebViewWidgetOptions(
      inAppWebViewOptions: InAppWebViewOptions(
        debuggingEnabled: true,
      )
  ),
  onWebViewCreated: (InAppWebViewController controller) {
    webView = controller;
  },
  onLoadStart: (InAppWebViewController controller, String url) {

  },
  onLoadStop: (InAppWebViewController controller, String url) {

  },
),

...
Share:
4,000
Captivity
Author by

Captivity

Software developer, designer, webdev. Symfony, BPMS, BPM.

Updated on December 15, 2022

Comments

  • Captivity
    Captivity over 1 year

    I use a flutter_webview_plugin to display the web page in the application, but when there is a video on the page there is no option to enable the full screen. Does anyone know how to solve this problem? Maybe some other plugin to display the page in the application?

    import 'package:flutter/material.dart';
    import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
    
    String url = "https://youtube.com/";
    
    void main() => runApp(MyApp());
    
    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Webview Example',
          theme: ThemeData.dark(),
          routes: {
            "/": (_) => Home(),
            "/webview": (_) => WebviewScaffold(
              url: url,
              appBar: AppBar(
                title: Text("WebView"),
              ),
              withJavascript: true,
              withLocalStorage: true,
              withZoom: true,
            )
          },
        );
      }
    }
    
    //Rest of the code
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
            appBar: AppBar(
              title: Text("WebView"),
            ),
            body: Center(
              child: Column(
                children: <Widget>[
                  Container(
                    padding: EdgeInsets.all(10.0),
                    child: TextField(
                      controller: controller,
                    ),
                  ),
                  RaisedButton(
                    child: Text("Open Webview"),
                    onPressed: () {
                      Navigator.of(context).pushNamed("/webview");
                    },
                  )
                ],
              ),
            )
        );
      }
    }