flutter_webview_plugin icon indicating copy to clipboard operation
flutter_webview_plugin copied to clipboard

WebView is not fullscreen

Open azkdev opened this issue 6 years ago • 14 comments

Hi there, i want just confirm is this a bug or not? Maybe I'm doing something wrong? Or maybe this is a Xiaomi specific bug when renders webview widget.

red offset on the right and bottom.

Screenschot

in the UI is nothing special:

return MaterialApp(
  home: Scaffold(
    body: SafeArea(
      child: WebviewScaffold(
         url: initialUrl,
         initialChild: Container(
           color: Colors.red,
             child: Center(
               child: Text("Loading..."),
              ),
            ),
          ),
        bottom: true,
        left: true,
        right: true,
        top: true,
      ),
    ),
 );

Thank you for help in advance =)

azkdev avatar Mar 21 '19 10:03 azkdev

@azkdev I have encountered the same problem.Have you solved it? @sethladd @ypelud @pedia

littlesalt avatar Mar 26 '19 06:03 littlesalt

@littlesalt hi there, i have no idea yet how can i solve this. but if i put a bottom navigation bar, the webview will cover all the screen without issues. maybe this is only a problem with Xiaomi? =) tested with iphone, samsung, meizu and it works perfectly =)

azkdev avatar Mar 26 '19 08:03 azkdev

@azkdev not only xiaomi, huawei has same problem!

littlesalt avatar Mar 26 '19 08:03 littlesalt

@azkdev What is the code to solve issues?

littlesalt avatar Mar 26 '19 08:03 littlesalt

Hi, I found the same problem yesterday on OnePlus 3/6T with the 1px empty, but some of my friends using Xiaomi has no empty space. 右侧和底部有1px的空白,跟随背景色变化。有些设备有,有些设备没有。

AlexV525 avatar Mar 26 '19 17:03 AlexV525

@AlexVincent525 是的,看了一下源码,没太搞明白。

littlesalt avatar Mar 27 '19 00:03 littlesalt

I'm happy to merge some fixes, but it works on my device so I cannot reproduce it.

charafau avatar Apr 03 '19 13:04 charafau

@charafau Thanks for your reply, i might try update package to see if this solved.

AlexV525 avatar Apr 03 '19 14:04 AlexV525

@charafau Sorry this problem still exist. Perhaps it will happened when display size was changed?

AlexV525 avatar Apr 04 '19 02:04 AlexV525

@AlexVincent525 How can display size change dynamically ?

charafau avatar Jun 12 '19 10:06 charafau

@charafau This issue isn't shown in latest version, so idk if there's still some of the users experiencing this or not.

AlexV525 avatar Jun 12 '19 14:06 AlexV525

I get the same on Android emulator on latest version.

I added this to make it fullscreen.

    flutterWebviewPlugin.onStateChanged.listen((state) {
      if(state.type == WebViewState.finishLoad) {
        flutterWebviewPlugin.resize(Rect.fromLTRB(
          MediaQuery.of(context).padding.left, /// for safe area
          MediaQuery.of(context).padding.top, /// for safe area
          MediaQuery.of(context).size.width + 1, /// add one to make it fullscreen
          MediaQuery.of(context).size.height,
        ));
      }
    });

vlowe85 avatar Aug 01 '19 13:08 vlowe85

I get the same on Android emulator on latest version.

I added this to make it fullscreen.

    flutterWebviewPlugin.onStateChanged.listen((state) {
      if(state.type == WebViewState.finishLoad) {
        flutterWebviewPlugin.resize(Rect.fromLTRB(
          MediaQuery.of(context).padding.left, /// for safe area
          MediaQuery.of(context).padding.top, /// for safe area
          MediaQuery.of(context).size.width + 1, /// add one to make it fullscreen
          MediaQuery.of(context).size.height,
        ));
      }
    });

got the same problem on Android emulator.

JarvanMo avatar Nov 02 '19 10:11 JarvanMo

If you are using app bar for that page, remove the appbar to stretch the WebviewScaffold into full screen .

And also wrap the widget using a container and set the width and height related to the device using MediaQuery.

Eg:

body: Container( width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.height, child: YouVimPlayer('vimeo', '588216519')),

Rafi404 avatar Sep 03 '21 11:09 Rafi404