Skip to content

[SystemChrome] setting systemNavigationBarColor and statusBarColor to white turns dark #108855

@marlonmp

Description

@marlonmp

Steps to Reproduce

  1. Execute flutter run on the code sample
  2. When I set systemNavigationBar and statusBar color white, its torn dark.

Expected results:

$ flutter run
Launching lib/main.dart on Redmi Note 8 in debug mode...
lib/main.dart:1
✓  Built build/app/outputs/flutter-apk/app-debug.apk.
Connecting to VM Service at ws://127.0.0.1:44717/9iGzxjG7EOg=/ws
I/com.example.ap(11107): Waiting for a blocking GC ProfileSaver
I/com.example.ap(11107): WaitForGcToComplete blocked ProfileSaver on RunEmptyCheckpoint for 6.440ms
E/LB      (11107): fail to open file: No such file or directory
V/MiuiFrameworkFactory(11107): get AllImpl object = android.common.MiuiFrameworkFactoryImpl@f8c57c5
W/MirrorManager(11107): this model don't Support

Actual results:

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {

  const MyApp({ super.key });

  @override
  MyAppState createState() => MyAppState();
}

class MyAppState extends State<MyApp> {

  @override
  Widget build(BuildContext context) {

    SystemChrome.setSystemUIOverlayStyle(
      const SystemUiOverlayStyle(
        statusBarBrightness: Brightness.dark,
        statusBarIconBrightness: Brightness.dark,
        statusBarColor: Colors.white,

        systemNavigationBarIconBrightness: Brightness.dark,
        systemNavigationBarColor: Colors.white,
      ),
    );


    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Container(
          alignment: Alignment.center,
          child: TextButton(
            onPressed: () {},
            child: const Text('toggle theme'),
          ),
        ),
      ),
    );
  }
}
Logs
$ flutter run --verbose

...

[   +3 ms] Flutter run key commands.
[   +2 ms] r Hot reload. 🔥🔥🔥
[   +1 ms] R Hot restart.
[        ] h List all available interactive commands.
[        ] d Detach (terminate "flutter run" but leave application running).
[        ] c Clear the screen
[        ] q Quit (terminate the application on the device).
[   +3 ms] 💪 Running with sound null safety 💪
[   +1 ms] An Observatory debugger and profiler on Redmi Note 8 is available at: http://127.0.0.1:39071/Wz4H_F6EEX8=/
[ +879 ms] The Flutter DevTools debugger and profiler on Redmi Note 8 is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:39071/Wz4H_F6EEX8=/
[ +160 ms] E/LB      (14795): fail to open file: No such file or directory
[+7992 ms] V/MiuiFrameworkFactory(14795): get AllImpl object = android.common.MiuiFrameworkFactoryImpl@f8c57c5
[        ] W/MirrorManager(14795): this model don't Support
$ flutter analyze
Analyzing app...                                                        
No issues found! (ran in 3.1s)
$ flutter doctor -v
[✓] Flutter (Channel stable, 3.0.0, on Manjaro Linux 5.10.133-1-MANJARO, locale es_CO.utf8)
    • Flutter version 3.0.0 at /home/marlon/Downloads/Repos/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ee4e09cce0 (hace 3 meses), 2022-05-09 16:45:18 -0700
    • Engine revision d1b9a6938a
    • Dart version 2.17.0
    • DevTools version 2.12.2

Checking Android licenses is taking an unexpectedly long time...[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at /home/marlon/.android
    • Platform android-32, build-tools 32.0.0
    • ANDROID_HOME = /home/marlon/.android
    • Java binary at: /usr/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.16+8)
    • All Android licenses accepted.

[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Linux toolchain - develop for Linux desktop
    • clang version 14.0.6
    • cmake version 3.23.2
    • ninja version 1.11.0
    • pkg-config version 1.8.0

[!] 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/linux#android-setup for detailed instructions).

[✓] VS Code
    • VS Code at /snap/code/current
    • Flutter extension version 3.46.0

[✓] Connected device (2 available)
    • Redmi Note 8 (mobile) • 12730032 • android-arm64 • Android 11 (API 30)
    • Linux (desktop)       • linux    • linux-x64     • Manjaro Linux 5.10.133-1-MANJARO

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 2 categories.
Without SystemChrome set: With white color set: With blue color set:
image image image

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: layoutSystemChrome and Framework's Layout Issuese: device-specificOnly manifests on certain devicesengineflutter/engine related. See also e: 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