Skip to content

[Android]Switching between immersive and edgeToEdge system UI modes shows black status bar #95403

@rasitayaz

Description

@rasitayaz

When I change SystemUiMode when rebuilding the app, the page's widgets are being moved and status bar area becomes completely black. This behavior occurs on my physical Android device which is Redmi Note 10 with operating system MIUI 12.

However, it works as expected on Android emulator and also on my previous physical device with Android One operating system.

Steps to Reproduce

bool _fullscreenEnabled = false;

@override
Widget build(BuildContext context) {
  SystemChrome.setEnabledSystemUIMode(
    _fullscreenEnabled ? SystemUiMode.immersive : SystemUiMode.edgeToEdge,
  );
  SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
    systemNavigationBarColor: Colors.transparent,
  ));

  return Scaffold(
    body: GestureDetector(
      onTap: () {
        setState(() => _fullscreenEnabled = !_fullscreenEnabled);
      },
      child:
          Image.network('https://www.wallpaperuse.com/wallp/83-836965_m.jpg'),
    ),
  );
}

Expected results:

This video recording is from Android emulator, Nexus 5 and it works as expected.

Android.Emulator.-.nexus-5_5554.2021-12-16.16-43-04.mp4

Actual results:

And this recording is from my physical Redmi Note 10 device with MIUI 12 operating system. As you can see, area of the statusbar becomes completely black when I switch to immersive mode.

Screenrecorder-2021-12-16-16-41-03-7.mp4
Logs

flutter run --verbose

[  +70 ms] executing: [D:\SDK\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[  +66 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[   +1 ms] cf4400006550b70f28e4b4af815151d1e74846c6
[        ] executing: [D:\SDK\flutter/] git tag --points-at cf4400006550b70f28e4b4af815151d1e74846c6
[  +52 ms] Exit code 0 from: git tag --points-at cf4400006550b70f28e4b4af815151d1e74846c6
[        ] 2.8.0
[   +7 ms] executing: [D:\SDK\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[  +34 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [D:\SDK\flutter/] git ls-remote --get-url origin
[  +32 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter
[ +107 ms] executing: [D:\SDK\flutter/] git rev-parse --abbrev-ref HEAD
[  +37 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[  +81 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +4 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +53 ms] executing: D:\SDK\android-sdk\platform-tools\adb.exe devices -l
[  +47 ms] List of devices attached
           5974a77a               device product:sunny_global model:M2101K7AG device:sunny transport_id:5
           emulator-5554          device product:sdk_gphone_x86_64 model:Android_SDK_built_for_x86_64 device:generic_x86_64 transport_id:3
[   +9 ms] D:\SDK\android-sdk\platform-tools\adb.exe -s 5974a77a shell getprop
[ +121 ms] D:\SDK\android-sdk\platform-tools\adb.exe -s emulator-5554 shell getprop
[  +39 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[  +14 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +72 ms] Multiple devices found:
[   +3 ms] ro.hardware = qcom
[   +1 ms] ro.hardware = ranchu
[  +26 ms] M2101K7AG (mobile)                    • 5974a77a      • android-arm64  • Android 11 (API 30)
[   +1 ms] Android SDK built for x86 64 (mobile) • emulator-5554 • android-x64    • Android 10 (API 29) (emulator)
[        ] Chrome (web)                          • chrome        • web-javascript • Google Chrome 96.0.4664.110
[        ] Edge (web)                            • edge          • web-javascript • Microsoft Edge 96.0.1054.53
[   +2 ms] [1]: M2101K7AG (5974a77a)
[        ] [2]: Android SDK built for x86 64 (emulator-5554)
[        ] [3]: Chrome (chrome)
[        ] [4]: Edge (edge)

flutter analyze

Analyzing playground...                                                 
No issues found! (ran in 3.2s)

flutter doctor -v

[√] Flutter (Channel stable, 2.8.0, on Microsoft Windows [Version 10.0.19043.1348], locale en-US)
    • Flutter version 2.8.0 at D:\SDK\flutter
    • Upstream repository https://github.com/flutter/flutter
    • Framework revision cf44000065 (8 days ago), 2021-12-08 14:06:50 -0800
    • Engine revision 40a99c5951
    • Dart version 2.15.0

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at D:\SDK\android-sdk
    • Platform android-30, build-tools 29.0.3
    • ANDROID_SDK_ROOT = D:\SDK\android-sdk
    • Java binary at: C:\Program Files\Common Files\Oracle\Java\javapath\java.exe
    • Java version Java(TM) SE Runtime Environment (build 15.0.2+7-27)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).

[√] VS Code (version 1.63.1)
    • VS Code at C:\Users\rasit\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.29.0

[√] Connected device (4 available)
    • M2101K7AG (mobile)                    • 5974a77a      • android-arm64  • Android 11 (API 30)
    • Android SDK built for x86 64 (mobile) • emulator-5554 • android-x64    • Android 10 (API 29) (emulator)
    • Chrome (web)                          • chrome        • web-javascript • Google Chrome 96.0.4664.110
    • Edge (web)                            • edge          • web-javascript • Microsoft Edge 96.0.1054.53

! Doctor found issues in 1 category.

(I don't use Android Studio)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: renderingUI glitches reported at the engine/skia or impeller rendering levele: device-specificOnly manifests on certain devicesframeworkflutter/packages/flutter repository. See also f: labels.platform-androidAndroid applications specificallyteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions