Question Detail

I am working on a WebView where I don't want any AppBar, So without AppBar my Container/ Widget or application body going behind the Status Bar in Flutter Application.

How to Hide or bring out application body from the Status bar?

Hide flutter application body behind Statusbar


Thread Reply

Hemant Sharma

- 1 months ago

You can use Primary attribute of your scaffold widget which helps to go behind and out from status bar

@override
Widget build(BuildContext context) {
return new Scaffold(
primary: true,
appBar: BlankBar(),
body: WebviewScaffold(
url: widget.url,
bottomNavigationBar: _buildLoadingBar(),
),);
}

and customize your AppBar

class  BlankBar  extends StatelessWidget implements PreferredSizeWidget {
  @override
  Widget build(BuildContext context) {
    return Container();
  }
  @override
  Size get preferredSize => Size(0.0,0.0);
}

Hemant Sharma

- 1 months ago

You can use Primary attribute of your scaffold widget which helps to go behind and out from status bar

@override
Widget build(BuildContext context) {
return new Scaffold(
primary: true,
appBar: BlankBar(),
body: WebviewScaffold(
url: widget.url,
bottomNavigationBar: _buildLoadingBar(),
),);
}

and customize your AppBar

class  BlankBar  extends StatelessWidget implements PreferredSizeWidget {
  @override
  Widget build(BuildContext context) {
    return Container();
  }
  @override
  Size get preferredSize => Size(0.0,0.0);
}

alex levine

- 16 days ago

On different Platforms, there are special areas like Status Bar on Android or the Notch on iPhone X that we might avoid drawing under.

The solution to this problem is SafeArea widget (example without/with SafeArea)

Widget build(BuildContext context) {
  return Material(
    color: Colors.blue,
    child: SafeArea(
      child: SizedBox.expand(
        child: Card(color: Colors.yellowAccent),
      ),
    ),
  );
}

Hemant Sharma

- 15 days ago

You can use SafeArea in body of Scaffold

Scaffold(
    body: SafeArea(
  child: YOUR_WIDGET_HERE
));

Hemant Sharma

- 15 days ago

You can use SafeArea in body of Scaffold

Scaffold(
    body: SafeArea(
  child: YOUR_WIDGET_HERE
));