Repository navigation
Flutter SystemUiOverlayStyle does not work with some configurations on Android #76384
Description
Activity
- addedin triagePresently being triaged by the triage teamPresently being triaged by the triage team
on Feb 22, 2021 @abhaysood
Check out this SO link and see if it answers your question. Also, provideflutter doctor -v- addedwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
on Feb 22, 2021 Check out this SO link and see if it answers your question. Also, provide
flutter doctor -v@darshankawar Updated the issue with
flutter doctor -voutput and I checked the SO answers, I'm already usingAnnotatedRegionas suggested in the accepted answer.- removedwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
on Feb 22, 2021 flutter doctor -v
[✓] Flutter (Channel stable, 1.22.6, on Mac OS X 10.15.4 19E2269 darwin-x64, locale en-IN) • Flutter version 1.22.6 at /Users/dhs/documents/Fluttersdk/flutter • Framework revision 9b2d32b605 (4 weeks ago), 2021-01-22 14:36:39 -0800 • Engine revision 2f0af37152 • Dart version 2.10.5 [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0) • Android SDK at /Users/dhs/Library/Android/sdk • Platform android-30, build-tools 30.0.0 • 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.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.3, Build version 12C33 • 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) [✓] VS Code (version 1.53.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.18.1 [✓] Connected device (1 available) • SM A260G (mobile) • 5200763ebcfa861f • android-arm • Android 8.1.0 (API 27) ! Doctor found issues in 1 category.- addedp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesfound in release: 1.22Found to occur in 1.22Found to occur in 1.22frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyAndroid applications specificallyand removedin triagePresently being triaged by the triage teamPresently being triaged by the triage team
on Feb 23, 2021 have you tried moving that block up before the scaffold?
Mine way is working both the workaround for transparent sytsemUIs and the edge-to-edge as well. I had to revert to some native hacking to couple it to the system chrome API calls
the repo is here https://github.com/fredgrott/base_river
Reacted by Abhay Sood and RydmikeI'm also using
AnnotatedRegion, withSystemUiOverlayStylemainly to change thesystemNavigationBarbar colors, opcaity etc. Before I was able to get everything as desired, but I now noticed an issue where if I do it as before and just no use (null) for allstatusBarsettings that are already set by theSystemUiOverlayStyleinAppBarThemeand just set things forsystemNavigationBarin theAnnotatedRegionit no longer works.Everything worked OK earlier, however it occurred to me, that was on Android 10 (API 29).
Now on Android 11 (API 30), when I do the same, the
statusBarIconBrightnessis not kept from itsAppBarTheme. TheAnnotatedRegionusage, even if itsSystemUiOverlayStyleprops for all status bar settings are null, changes the status bars icon brightness to the wrong value.So I tried setting the
statusBarIconBrightnessto its right value inAnnotatedRegionusage too, but it does not help. No props in it will set them to the correct brightness. This seems to only happen on API 30. On levels 29 and lower, things seem to work OK as before.I also tried using the newer
SystemUiOverlayStylepropsystemStatusBarContrastEnforced, but it had no impact on the issue.I will probably make a simple repro case to verify this finding, and then post it as separate issue.
Reacted by Abhay Sood and Yusuke OtsukaTo update this issue, there was a bug -- there were some missing window flags checks that are needed to change the status bar color. This PR should fix it when it lands!
Reacted by Rydmike and Abhay Sood@camsim99 The PR has landed, can we close this issue?
Reacted by Camille Simon and Abhay Sood- addedr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
on May 26, 2022 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 -vand a minimal reproduction of the issue.- locked as resolved and limited conversation to collaborators
on Jun 9, 2022
I'm using
AnnotatedRegionwidget to change status bar color. I expect the status bar color to switch between white and transparent. But nothing happens. Check_getSystemUiOverlayStylemethod for how it's being done.I tried changing the content of the
_getSystemUiOverlayStylemethod to the following, and then it successfully changes the color.Is this a bug or am I missing something?
Sample App
Flutter doctor