Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Statusbar overlapping in webview #296

Closed
UwaisWisitech opened this issue Jan 14, 2019 · 6 comments
Closed

Statusbar overlapping in webview #296

UwaisWisitech opened this issue Jan 14, 2019 · 6 comments
Labels

Comments

@UwaisWisitech
Copy link

I have integrated web view in my flutter App but status bar overlapping the web view .

git

@UwaisWisitech
Copy link
Author

Here is my code

return new MaterialApp(
  debugShowCheckedModeBanner: false,
  home: Container(
    margin: const EdgeInsets.only(top: 0.0),
    child: SafeArea(
      top: false,
      child: new WebviewScaffold(
          url: selectedUrl,
          withZoom: true,
          withLocalStorage: true,
          hidden: true,
        initialChild: Container(
          color: Colors.white,
          child: const Center(
            child: Text('Waiting.....'),
          ),
        ),
      ),
    ),
  )

,
);

@sameerbakre
Copy link

sameerbakre commented Jan 15, 2019

There is no direct way to handle it. You have two options here. Either add appBar and everything would be taken care by itself. Or other option is little bit dirty coding. Once your page is loaded call following

flutterWebviewPlugin.resize(_buildRect())

Rect _buildRect() {
final topPadding = mediaQuery.padding.top;
final top = topPadding;
var height = mediaQuery.size.height - top;
height -= 56.0 + mediaQuery.padding.bottom;
if (height < 0.0) {
height = 0.0;
}
return new Rect.fromLTWH(0.0, top, mediaQuery.size.width, height);
}

@iontichy123
Copy link

Sorry, for newbee question. How/where to initialize this medioQuery member?

@iontichy123
Copy link

iontichy123 commented Feb 4, 2019

Found another solution, instead of AppBar I've used this:

appBar: PreferredSize( 
                child: Container(),
                preferredSize: Size.fromHeight(0.0),
              ) 

@baoxiehao
Copy link

Here is my code

return new MaterialApp(
  debugShowCheckedModeBanner: false,
  home: Container(
    margin: const EdgeInsets.only(top: 0.0),
    child: SafeArea(
      top: false,
      child: new WebviewScaffold(
          url: selectedUrl,
          withZoom: true,
          withLocalStorage: true,
          hidden: true,
        initialChild: Container(
          color: Colors.white,
          child: const Center(
            child: Text('Waiting.....'),
          ),
        ),
      ),
    ),
  )

,
);

It does not work for me.

@charafau
Copy link
Collaborator

@sameerbakre already answered this question either use AppBar or use rect constructor to resize webview, coping for everyone:

futterWebviewPlugin.resize(_buildRect())

Rect _buildRect() {
   final topPadding = mediaQuery.padding.top;
   final top = topPadding;
   var height = mediaQuery.size.height - top;
   height -= 56.0 + mediaQuery.padding.bottom;

   if (height < 0.0) {
      height = 0.0;
   }

   return new Rect.fromLTWH(0.0, top, mediaQuery.size.width, height);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants