WebView is not fullscreen
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.
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 I have encountered the same problem.Have you solved it? @sethladd @ypelud @pedia
@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 not only xiaomi, huawei has same problem!
@azkdev What is the code to solve issues?
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的空白,跟随背景色变化。有些设备有,有些设备没有。
@AlexVincent525 是的,看了一下源码,没太搞明白。
I'm happy to merge some fixes, but it works on my device so I cannot reproduce it.
@charafau Thanks for your reply, i might try update package to see if this solved.
@charafau Sorry this problem still exist. Perhaps it will happened when display size was changed?
@AlexVincent525 How can display size change dynamically ?
@charafau This issue isn't shown in latest version, so idk if there's still some of the users experiencing this or not.
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,
));
}
});
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.
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')),