Enables system chrome customization on Android O and greater#5112
Enables system chrome customization on Android O and greater#5112jonahwilliams merged 20 commits intoflutter:masterfrom
Conversation
remove log
| switch (style) { | ||
| case "SystemUiOverlayStyle.light": | ||
| window.setNavigationBarColor(0xffffffff); | ||
| flags |= 16; |
There was a problem hiding this comment.
Not sure what Android convention is, but personally bitwise operations read a lot clearer to me using hex literals.
| 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.
Is View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR not available?
There was a problem hiding this comment.
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 |
| switch (navigationIconTheme) { | ||
| case "SystemChromeTheme.dark": | ||
| //View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; | ||
| if ((flags & 0x10) == 0) { |
There was a problem hiding this comment.
This test and the similar tests below don't seem necessary?
There was a problem hiding this comment.
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.
But x |= 0x10 doesn't toggle the bit, it just ensures that it's set. 0x10 | 0x10 == 0 | 0x10
|
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.
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