Search code examples
flutterandroid-statusbar

How to hide Android StatusBar in Flutter


How to hide the Android Status Bar in a Flutter App?

Android Status Bar


Solution

  • 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 only hide the status 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
    
      }