Home > Mobile >  Statusbar padding even when hidden (flutter)
Statusbar padding even when hidden (flutter)

Time:10-12

I'm trying to make an immersive view, where nothing is over the widget.

But even with SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive), the status bar still takes a place where it used to be.

For a test widget, this is what I used

return Container(color: Colors.red);

That is the entire widget, yet it still has a status bar padding

enter image description here

When I use a Scaffold, I can draw behind the Status Bar, but when there is no Status Bar, it still takes up the extra space.

CodePudding user response:

This should do the trick

void main() {
      SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom]);
      runApp(MyApp());
    }

You can also make it transparent

SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(statusBarColor: Colors.transparent, ));

CodePudding user response:

Apparently using

<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>

In styles.xml fixed it, because my emulator had a simulated cutout

  • Related