I need to hide the Android Status bar in my app so i am using the following code

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

main() {

class MyApp extends StatelessWidget {
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
            body: Center(child: TextField()), backgroundColor: Colors.orange));

I have a textfield in the screen so whenever the Android Keyboard opens the status bar reappears. I have tried with multiple Android devices and i am getting the same bug.

Is this really a bug in the framework or am i doing something wrong?

I have attached a short video link below to show the bug


I have not tested in iOS

Solution 1: Keerti Purswani

Please share some code. I tried adding SystemChrome.setEnabledSystemUIOverlays([]); in initState() and I have a text field, It is working fine.

Solution 2: s k

What I did is after the Keyboard was shown, delay for 2 (the doc says one) seconds and then call setEnabledSystemUIOverlays again.

Future.delayed(Duration(seconds: 2)).then((value) => SystemChrome.setEnabledSystemUIOverlays([]));

According to: https://api.flutter.dev/flutter/services/SystemChrome/setEnabledSystemUIOverlays.html

when the keyboard becomes visible, it will enable the navigation bar and status bar system UI overlays. When the keyboard is closed, Android will not restore the previous UI visibility settings, and the UI visibility cannot be changed until 1 second after the keyboard is closed to prevent malware locking users from navigation buttons.

To regain "fullscreen" after text entry, the UI overlays should be set again after a delay of 1 second. This can be achieved through restoreSystemUIOverlays or calling this again. Otherwise, the original UI overlay settings will be automatically restored only when the application loses and regains focus.