-
Notifications
You must be signed in to change notification settings - Fork 6k
Enables system chrome customization on Android O and greater #5112
Conversation
remove log
| switch (style) { | ||
| case "SystemUiOverlayStyle.light": | ||
| window.setNavigationBarColor(0xffffffff); | ||
| flags |= 16; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what Android convention is, but personally bitwise operations read a lot clearer to me using hex literals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| window.setNavigationBarColor(0xffffffff); | ||
| flags |= 16; | ||
| if ((flags & 16) == 0) { | ||
| flags |= 16; //View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR not available?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not until we update our target SDK
|
I've updated this PR based on offline discussion with @Hixie and @HansMuller. Instead of just extending the dark and light theme to Android, we should allow users to customize all of the different system chrome related APIs. This PR works in tandem with https://github.com/flutter/flutter/pull/17171/files to extend the systemOverlayStyle with multiple values for the different parts of each platforms system chrome. Currently on Android, versions less than 26 are not allowed to customize these settings from flutter since there are no "light" settings for the status or nav bar icons. As a part of a later process, we'll remove the SystemChrome api calls from the app bar widgets and instead specify a theme-like way to customize system chrome. This is only intended to be a low-level API |
HansMuller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| switch (navigationIconTheme) { | ||
| case "SystemChromeTheme.dark": | ||
| //View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; | ||
| if ((flags & 0x10) == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test and the similar tests below don't seem necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bit-fu is weak, but I believe this is necessary because we currently can set the same system chrome flag multiple times. If it is already on/off we don't want to toggle it again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But x |= 0x10 doesn't toggle the bit, it just ensures that it's set. 0x10 | 0x10 == 0 | 0x10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, fixed
|
Since this will require an engine roll and and a separate framework PR i'm going to wait until tomorrow when the build is hopefully green |
| flags |= 0x10; | ||
| break; | ||
| case "Brightness.light": | ||
| if ((flags & 0x10) == 0x10) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for not bringing this up earlier. To unconditionally turn a bit off:
flags &= ~0x10;
…flutter#5167) * Revert "Roll dart sdk to e6d7d67. (flutter#5165)" This reverts commit 9e4c5d0. * Revert "Enables system chrome customization on Android M/O and greater (flutter#5112)" This reverts commit f2db5df.
…flutter#5167) * Revert "Roll dart sdk to e6d7d67. (flutter#5165)" This reverts commit 9e4c5d0. * Revert "Enables system chrome customization on Android M/O and greater (flutter#5112)" This reverts commit f2db5df.
…flutter#5167) * Revert "Roll dart sdk to e6d7d67. (flutter#5165)" This reverts commit 9e4c5d0. * Revert "Enables system chrome customization on Android M/O and greater (flutter#5112)" This reverts commit f2db5df.
Fixes flutter/flutter#16837