How to hide the Android Status Bar in a Flutter App?
The right and simplest way to remove back button on Appbar in Flutter is to set the automaticallyImplyLeading property of the AppBar to false and replace the old screen in a stack with the current/new screen.
To hide status bar in Android using Kotlin, we can request that the visibility of the status bar or other screen/window decorations be changed by setting window. decorView. systemUiVisibility with View. SYSTEM_UI_FLAG_FULLSCREEN in the Activity Kotlin file.
SystemChrome.setEnabledSystemUIOverlays([])
should do what you want.
You can bring it back with SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values)
.
Import it using
import 'package:flutter/services.dart';
Update answer (from Flutter 2.5 or latest):
SystemChrome.setEnabledSystemUIMode(SystemUiMode.leanBack);
Or you can use another options like:
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [ SystemUiOverlay.bottom ]); // to hide only bottom bar
Then when you need to re-show it (like when dispose) use this:
@override void dispose() { super.dispose(); SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: SystemUiOverlay.values); // to re-show bars }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With