Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SystemChrome setSystemUIOverlayStyle failed #59130

Closed
weiminghuaa opened this issue Jun 10, 2020 · 10 comments
Closed

SystemChrome setSystemUIOverlayStyle failed #59130

weiminghuaa opened this issue Jun 10, 2020 · 10 comments
Labels
a: layout SystemChrome and Framework's Layout Issues found in release: 1.22 Found to occur in 1.22 found in release: 1.26 Found to occur in 1.26 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds

Comments

@weiminghuaa
Copy link

SystemChrome.setSystemUIOverlayStyle(
       SystemUiOverlayStyle(statusBarBrightness: Brightness.light)
);

Execute this code, and add print(_pendingStyle); in setSystemUIOverlayStyle function

alway print twice

flutter: {systemNavigationBarColor: null, systemNavigationBarDividerColor: null, statusBarColor: null, statusBarBrightness: Brightness.light, statusBarIconBrightness: null, systemNavigationBarIconBrightness: null}
flutter: {systemNavigationBarColor: null, systemNavigationBarDividerColor: null, statusBarColor: null, statusBarBrightness: Brightness.dark, statusBarIconBrightness: Brightness.light, systemNavigationBarIconBrightness: null}
@iapicca
Copy link
Contributor

iapicca commented Jun 10, 2020

Hi @weiminghuaa
Can you please provide your flutter doctor -v,
your flutter run --verbose
and a minimal complete reproducible code sample.
Thank you

@iapicca iapicca added in triage Presently being triaged by the triage team waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds labels Jun 10, 2020
@weiminghuaa
Copy link
Author

weiminghuaa commented Jun 11, 2020

Hi @iapicca Thank you for reply.
run flutter ceate example,add this code
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark); in _incrementCounter method at main.dart file, and you will see it

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jun 11, 2020
@weiminghuaa
Copy link
Author

➜  example flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.17.3, on Mac OS X 10.15.5 19F101, locale zh-Hans-CN)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    ✗ Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
[!] Android Studio (version 3.6)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.45.1)
 
[✓] Connected device (2 available)            

! Doctor found issues in 2 categories.

@TahaTesser
Copy link
Member

TahaTesser commented Jun 11, 2020

Code Sample
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
  SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark);
  runApp(MyApp());
}
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Material App',
      // theme: ThemeData.dark(),
      home: Home(),
    );
  }
}
class Home extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Material App Bar'),
      ),
      body: Center(
        child: Container(
          child: Text('Hello World'),
        ),
      ),
      floatingActionButton: FloatingActionButton(
        child: Icon(Icons.add),
        onPressed: () {
          SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark);
        },
      ),
    );
  }
}
flutter doctor -v
[✓] Flutter (Channel dev, 1.19.0-5.0.pre, on Mac OS X 10.15.5 19F101, locale
    en-GB)
    • Flutter version 1.19.0-5.0.pre at /Users/tahatesser/Code/flutter_dev
    • Framework revision c264b70ec3 (3 days ago), 2020-06-08 09:27:34 -0700
    • Engine revision c7f9725521
    • Dart version 2.9.0 (build 2.9.0-13.0.dev 87c5e3612b)

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/tahatesser/Code/sdk
    • Platform android-29, build-tools 29.0.3
    • ANDROID_HOME = /Users/tahatesser/Code/sdk
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.5, Build version 11E608c
    • CocoaPods version 1.9.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 46.0.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.46.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.11.0

[✓] Connected device (4 available)
    • SM M305F   • 32003c30dc19668f • android-arm64  • Android 10 (API 29)
    • macOS      • macOS            • darwin-x64     • Mac OS X 10.15.5 19F101
    • Web Server • web-server       • web-javascript • Flutter Tools
    • Chrome     • chrome           • web-javascript • Google Chrome
      83.0.4103.97

• No issues found!

Could be related #21265

@TahaTesser TahaTesser added a: layout SystemChrome and Framework's Layout Issues found in release: 1.19 Found to occur in 1.19 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on and removed in triage Presently being triaged by the triage team labels Jun 11, 2020
@iapicca iapicca mentioned this issue Jun 24, 2020
@note8g2018
Copy link

Hi I am who mentioned small bug #60050.
here is my code:

import 'package:flutter/material.dart';
import 'package:coolme121/screen/LogIn_screen.dart';
import 'package:flutter/services.dart';


class MyApp extends StatelessWidget
{
  @override
  Widget build(BuildContext context)
  {
    SystemChrome.setSystemUIOverlayStyle(
      SystemUiOverlayStyle(
        statusBarColor: Colors.green,
        statusBarIconBrightness: Brightness.dark,
        systemNavigationBarColor: Colors.green,
        systemNavigationBarIconBrightness: Brightness.dark,
      ),
    );

    return MaterialApp(
      debugShowCheckedModeBanner: false,

      themeMode: ThemeMode.dark,
      darkTheme: ThemeData(
        brightness: Brightness.dark,
      ),

      title: 'CoolME',
      initialRoute: LogIn.route,
      routes:
      {
        LogIn.route: (context) => LogIn(),
      },
    );
  }
}

and here is my flutter run --verbose:

Microsoft Windows [Version 10.0.18363.900]
(c) 2019 Microsoft Corporation. All rights reserved.

D:\code\flutter\coolme121>flutter run --verbose
[  +21 ms] executing: [C:\src\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[  +86 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] 1ad9baa8b99a2897c20f9e6e54d3b9b359ade314
[        ] executing: [C:\src\flutter/] git tag --contains HEAD
[ +237 ms] Exit code 0 from: git tag --contains HEAD
[   +1 ms] 1.17.4
[  +12 ms] executing: [C:\src\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[  +62 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [C:\src\flutter/] git ls-remote --get-url origin
[  +56 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[ +134 ms] executing: [C:\src\flutter/] git rev-parse --abbrev-ref HEAD
[  +68 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[  +47 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[        ] 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.
[   +6 ms] Artifact Instance of 'WindowsEngineArtifacts' 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.
[  +47 ms] executing: C:\Users\GL553VD\AppData\Local\Android\sdk\platform-tools\adb.exe devices -l
[  +51 ms] List of devices attached
[   +3 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[        ] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[        ] 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.
[        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ] Artifact Instance of 'WindowsEngineArtifacts' 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.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[  +49 ms] No supported devices connected.
[   +9 ms] "flutter run" took 302ms.

#0      throwToolExit (package:flutter_tools/src/base/common.dart:14:3)
#1      RunCommand.validateCommand (package:flutter_tools/src/commands/run.dart:336:7)
<asynchronous suspension>
#2      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:703:11)
<asynchronous suspension>
#3      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:620:33)
<asynchronous suspension>
#4      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart)
#5      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:29)
#6      _rootRun (dart:async/zone.dart:1184:13)
#7      _CustomZone.run (dart:async/zone.dart:1077:19)
#8      _runZoned (dart:async/zone.dart:1619:10)
#9      runZoned (dart:async/zone.dart:1539:10)
#10     AppContext.run (package:flutter_tools/src/base/context.dart:149:18)
#11     FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:610:20)
#12     CommandRunner.runCommand (package:args/command_runner.dart:197:27)
#13     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:339:21)
<asynchronous suspension>
#14     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart)
#15     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:29)
#16     _rootRun (dart:async/zone.dart:1184:13)
#17     _CustomZone.run (dart:async/zone.dart:1077:19)
#18     _runZoned (dart:async/zone.dart:1619:10)
#19     runZoned (dart:async/zone.dart:1539:10)
#20     AppContext.run (package:flutter_tools/src/base/context.dart:149:18)
#21     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:288:19)
#22     CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:112:25)
#23     new Future.sync (dart:async/future.dart:224:31)
#24     CommandRunner.run (package:args/command_runner.dart:112:14)
#25     FlutterCommandRunner.run (package:flutter_tools/src/runner/flutter_command_runner.dart:231:18)
#26     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:63:22)
#27     _rootRun (dart:async/zone.dart:1184:13)
#28     _CustomZone.run (dart:async/zone.dart:1077:19)
#29     _runZoned (dart:async/zone.dart:1619:10)
#30     runZonedGuarded (dart:async/zone.dart:1608:12)
#31     runZoned (dart:async/zone.dart:1536:12)
#32     run.<anonymous closure> (package:flutter_tools/runner.dart:61:18)
<asynchronous suspension>
#33     run.<anonymous closure> (package:flutter_tools/runner.dart)
#34     runInContext.runnerWrapper (package:flutter_tools/src/context_runner.dart:64:18)
<asynchronous suspension>
#35     runInContext.runnerWrapper (package:flutter_tools/src/context_runner.dart)
#36     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:29)
#37     _rootRun (dart:async/zone.dart:1184:13)
#38     _CustomZone.run (dart:async/zone.dart:1077:19)
#39     _runZoned (dart:async/zone.dart:1619:10)
#40     runZoned (dart:async/zone.dart:1539:10)
#41     AppContext.run (package:flutter_tools/src/base/context.dart:149:18)
#42     runInContext (package:flutter_tools/src/context_runner.dart:67:24)
#43     run (package:flutter_tools/runner.dart:48:10)
#44     main (package:flutter_tools/executable.dart:69:9)
#45     main (file:///C:/src/flutter/packages/flutter_tools/bin/flutter_tools.dart:8:3)
#46     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#47     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

and here is my flutter doctor -v

D:\code\flutter\coolme121>flutter doctor -v
[√] Flutter (Channel stable, v1.17.4, on Microsoft Windows [Version 10.0.18363.900], locale en-US)
    • Flutter version 1.17.4 at C:\src\flutter
    • Framework revision 1ad9baa8b9 (6 days ago), 2020-06-17 14:41:16 -0700Engine revision ee76268252
    • Dart version 2.8.4


[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at C:\Users\GL553VD\AppData\Local\Android\sdk
    • Platform android-29, build-tools 29.0.3Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
    • All Android licenses accepted.

[√] Android Studio (version 3.6)
    • Android Studio at C:\Program Files\Android\Android Studio1Flutter plugin version 46.0.1Dart plugin version 192.8052Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[√] VS Code (version 1.46.1)
    • VS Code at C:\Users\GL553VD\AppData\Local\Programs\Microsoft VS CodeFlutter extension version 3.11.0

[√] Connected device (1 available)
    • AOSP on IA Emulator • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)

• No issues found!

@pedromassangocode
Copy link

pedromassangocode commented Dec 31, 2020

I was able to reproduce on latest master, dev and stable channel.

gif

flutter doctor
[✓] Flutter (Channel stable, 1.22.5, on Mac OS X 10.15.7 19H2 darwin-x64, locale en)
    • Flutter version 1.22.5 at /Users/pedromassango/dev/SDKs/flutter_stable
    • Framework revision 7891006299 (3 weeks ago), 2020-12-10 11:54:40 -0800
    • Engine revision ae90085a84
    • Dart version 2.10.4

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/pedromassango/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.1, Build version 12A7403
    • CocoaPods version 1.9.3

[!] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] IntelliJ IDEA Community Edition (version 2020.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin installed
    • Dart plugin version 203.5981.152

[✓] VS Code (version 1.51.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.16.0

[✓] Connected device (2 available)
    • Redmi 5 Plus (mobile)              • 0258ff700005  • android-arm64 • Android 8.1.0 (API 27)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86   • Android 10 (API 29) (emulator)

! Doctor found issues in 1 category.
Process finished with exit code 0

@pedromassangocode pedromassangocode added found in release: 1.22 Found to occur in 1.22 found in release: 1.26 Found to occur in 1.26 and removed found in release: 1.19 Found to occur in 1.19 labels Dec 31, 2020
@goderbauer
Copy link
Member

@Piinks

@goderbauer goderbauer added the P2 Important issues not at the top of the work list label Aug 30, 2022
@Piinks
Copy link
Contributor

Piinks commented Sep 19, 2022

Hi there, this looks like it is working as expected. The AppBar initiates its own SystemChrome with an AnnotatedRegion in order to implement proper contrast. AppBar.systemOverlayStyle allows you to access this built in overlay styling.

@Piinks Piinks added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Sep 19, 2022
@github-actions
Copy link

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now.
If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones.
Thanks for your contribution.

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: layout SystemChrome and Framework's Layout Issues found in release: 1.22 Found to occur in 1.22 found in release: 1.26 Found to occur in 1.26 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds
Projects
None yet
Development

No branches or pull requests

7 participants