Hide Android status bar in Flutter app

How can I hide Android status bar in Flutter app?

Android status bar

+25
flutter
source share
5 answers

SystemChrome.setEnabledSystemUIOverlays([]) should do what you want.

You can get it back using SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values) .

Import it using

 import 'package:flutter/services.dart'; 
+48
source share

You can use SystemChrome.setEnabledSystemUIOverlays([]) to hide, and SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values) to return it again.

However, there will be a small gray area, and now this is not fixed. When the status bar is hidden, the height of the application panel remains unchanged.

See the problem with github: https://github.com/flutter/flutter/issues/14432

+7
source share

This comment from Jonah Williams may also be useful in some situations https://github.com/flutter/flutter/issues/24472#issuecomment-440015464 if you do not want the color of the status bar to be overridden by the AppBar.

You cannot provide the color of the status bar for the application panel, but you can create your own annotated region. This is not very intuitive right now, but you can use sized: false to override the child annotated area created by the application panel.

Somewhere, perhaps in childhood, on the scaffold

 Scaffold( body: AnnotatedRegion<SystemUiOverlayStyle>( value: const SystemUiOverlayStyle(...), sized: false, child: ... ) ); 

Please note that not all Android versions support status bar color or icon brightness. See the SystemUiOverlayStyle Documentation for warnings.

0
source share

You can add the code below to your main function to hide the status bar.

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

Go to AndroidManifest.xml and use this theme

 android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
0
source share

All Articles