How can I hide Android status bar in Flutter app?
SystemChrome.setEnabledSystemUIOverlays([]) should do what you want.
SystemChrome.setEnabledSystemUIOverlays([])
You can get it back using SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values) .
SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values)
Import it using
import 'package:flutter/services.dart';
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
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.
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.
sized: false
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.
You can add the code below to your main function to hide the status bar.
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( statusBarColor: Colors.transparent, ));
Go to AndroidManifest.xml and use this theme
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"