doesn’t change colors

Steps to Reproduce

Run the code sample and enable different sections of it to see the effect and click the button

Expected results: when change color without brightness, it should change

Actual results: nothing happens, no assertions, warnings, and this behavior is not documented as far as I can tell.
Verified on Android 9 and Android 11

Code sample

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

Future<void> main() async {
  runApp(App());
}

class App extends StatefulWidget {
  @override
  State<App> createState() => _AppState();
}

class _AppState extends State<App> {
  bool red = true;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Center(
              child: ElevatedButton(
                onPressed: () {
                  final color = red ? Color(0xffff0000) : Color(0xff00ff00);
                  red = !red;

                  // divider color is changing, other colors are not

                  SystemChrome.setSystemUIOverlayStyle(
                    SystemUiOverlayStyle(
                      systemNavigationBarColor: color,
                      statusBarColor: color,
                      systemNavigationBarDividerColor: color,
                      // statusBarBrightness: Brightness.light,
                      // statusBarIconBrightness: Brightness.light,
                      // systemNavigationBarIconBrightness: Brightness.light,

                      // These parameters do not affect the situation, whether they are true or false
                      //
                      //
                      // systemStatusBarContrastEnforced: false,
                      // systemNavigationBarContrastEnforced: false,
                    ),
                  );

                  // status bar now changes color (no matter what brightenss is set)

                  // SystemChrome.setSystemUIOverlayStyle(
                  //   SystemUiOverlayStyle(
                  //     systemNavigationBarColor: color,
                  //     statusBarColor: color,
                  //     systemNavigationBarDividerColor: color,
                  //     statusBarBrightness: Brightness.light,
                  //     statusBarIconBrightness: Brightness.light,
                  //     // systemNavigationBarIconBrightness: Brightness.light,
                  //   ),
                  // );

                  // nav bar now changes color (no matter what brightenss is set)

                  // SystemChrome.setSystemUIOverlayStyle(
                  //   SystemUiOverlayStyle(
                  //     systemNavigationBarColor: color,
                  //     statusBarColor: color,
                  //     systemNavigationBarDividerColor: color,
                  //     // statusBarBrightness: Brightness.light,
                  //     // statusBarIconBrightness: Brightness.light,
                  //     systemNavigationBarIconBrightness: Brightness.light,
                  //   ),
                  // );

                  // all colors are changing (no matter what brightenss is set)
                  
                  // SystemChrome.setSystemUIOverlayStyle(
                  //   SystemUiOverlayStyle(
                  //     systemNavigationBarColor: color,
                  //     statusBarColor: color,
                  //     systemNavigationBarDividerColor: color,
                  //     statusBarBrightness: Brightness.light,
                  //     statusBarIconBrightness: Brightness.light,
                  //     systemNavigationBarIconBrightness: Brightness.light,
                  //   ),
                  // );
                },
                child: Text('click'),
              ),
            )
          ],
        ),
      ),
    );
  }
}
Logs

[√] Flutter (Channel master, 2.5.0-7.0.pre.83, on Microsoft Windows [Version 10.0.19041.1110], locale ru-RU)
    • Flutter version 2.5.0-7.0.pre.83 at C:\dev\src\flutter
    • Upstream repository git@github.com:nt4f04und/flutter.git
    • FLUTTER_GIT_URL = git@github.com:nt4f04und/flutter.git
    • Framework revision 06be7e5392 (4 hours ago), 2021-08-15 14:37:02 -0400
    • Engine revision 1af0a20793
    • Dart version 2.15.0 (build 2.15.0-15.0.dev)

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at C:\Users\danya\AppData\Local\Android\sdk
    X cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.

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

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.7.7)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.7.30621.155
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 4.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] IntelliJ IDEA Community Edition (version 2020.3)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.3.3
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart

[√] VS Code (version 1.59.0)
    • VS Code at C:\Users\danya\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.25.0

[√] Connected device (4 available)
    • Redmi Note 5 (mobile)   • 40c9f14       • android-arm64  • Android 9 (API 28)
    • sdk gphone x86 (mobile) • emulator-5554 • android-x86    • Android 11 (API 30) (emulator)
    • Windows (desktop)       • windows       • windows-x64    • Microsoft Windows [Version 10.0.19041.1110]
    • Chrome (web)            • chrome        • web-javascript • Google Chrome 92.0.4515.131
    • Edge (web)              • edge          • web-javascript • Microsoft Edge 92.0.902.67

! Doctor found issues in 1 category.

1 thought on “doesn’t change colors

Comments are closed.